
(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
def code(x, y, z, t): return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
def code(x, y, z, t): return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\end{array}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z t) x)) (t_2 (/ (+ x (/ (- (* y z) x) t_1)) (+ x 1.0))))
(if (<= t_2 -5e+141)
(* y (/ (/ z (+ x 1.0)) t_1))
(if (<= t_2 5e+238) t_2 (/ (+ x (/ y t)) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -5e+141) {
tmp = y * ((z / (x + 1.0)) / t_1);
} else if (t_2 <= 5e+238) {
tmp = t_2;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z * t) - x
t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0d0)
if (t_2 <= (-5d+141)) then
tmp = y * ((z / (x + 1.0d0)) / t_1)
else if (t_2 <= 5d+238) then
tmp = t_2
else
tmp = (x + (y / t)) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -5e+141) {
tmp = y * ((z / (x + 1.0)) / t_1);
} else if (t_2 <= 5e+238) {
tmp = t_2;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * t) - x t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0) tmp = 0 if t_2 <= -5e+141: tmp = y * ((z / (x + 1.0)) / t_1) elif t_2 <= 5e+238: tmp = t_2 else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) t_2 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / t_1)) / Float64(x + 1.0)) tmp = 0.0 if (t_2 <= -5e+141) tmp = Float64(y * Float64(Float64(z / Float64(x + 1.0)) / t_1)); elseif (t_2 <= 5e+238) tmp = t_2; else tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * t) - x; t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0); tmp = 0.0; if (t_2 <= -5e+141) tmp = y * ((z / (x + 1.0)) / t_1); elseif (t_2 <= 5e+238) tmp = t_2; else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+141], N[(y * N[(N[(z / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+238], t$95$2, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t - x\\
t_2 := \frac{x + \frac{y \cdot z - x}{t\_1}}{x + 1}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+141}:\\
\;\;\;\;y \cdot \frac{\frac{z}{x + 1}}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+238}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < -5.00000000000000025e141Initial program 63.3%
*-commutative63.3%
Simplified63.3%
Taylor expanded in y around inf 62.9%
associate-/l*85.8%
associate-/r*95.2%
+-commutative95.2%
Simplified95.2%
if -5.00000000000000025e141 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 4.99999999999999995e238Initial program 99.0%
if 4.99999999999999995e238 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 38.7%
*-commutative38.7%
Simplified38.7%
Taylor expanded in z around inf 93.8%
Final simplification98.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ x (/ y t)) (+ x 1.0))))
(if (<= t -2.4e-136)
t_1
(if (<= t -8.5e-229)
(+ 1.0 (/ (* z t) (* x (+ x 1.0))))
(if (<= t -3.8e-259)
(/ (* y z) (* x (- -1.0 x)))
(if (<= t 2e-145) 1.0 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (x + (y / t)) / (x + 1.0);
double tmp;
if (t <= -2.4e-136) {
tmp = t_1;
} else if (t <= -8.5e-229) {
tmp = 1.0 + ((z * t) / (x * (x + 1.0)));
} else if (t <= -3.8e-259) {
tmp = (y * z) / (x * (-1.0 - x));
} else if (t <= 2e-145) {
tmp = 1.0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x + (y / t)) / (x + 1.0d0)
if (t <= (-2.4d-136)) then
tmp = t_1
else if (t <= (-8.5d-229)) then
tmp = 1.0d0 + ((z * t) / (x * (x + 1.0d0)))
else if (t <= (-3.8d-259)) then
tmp = (y * z) / (x * ((-1.0d0) - x))
else if (t <= 2d-145) then
tmp = 1.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x + (y / t)) / (x + 1.0);
double tmp;
if (t <= -2.4e-136) {
tmp = t_1;
} else if (t <= -8.5e-229) {
tmp = 1.0 + ((z * t) / (x * (x + 1.0)));
} else if (t <= -3.8e-259) {
tmp = (y * z) / (x * (-1.0 - x));
} else if (t <= 2e-145) {
tmp = 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (y / t)) / (x + 1.0) tmp = 0 if t <= -2.4e-136: tmp = t_1 elif t <= -8.5e-229: tmp = 1.0 + ((z * t) / (x * (x + 1.0))) elif t <= -3.8e-259: tmp = (y * z) / (x * (-1.0 - x)) elif t <= 2e-145: tmp = 1.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)) tmp = 0.0 if (t <= -2.4e-136) tmp = t_1; elseif (t <= -8.5e-229) tmp = Float64(1.0 + Float64(Float64(z * t) / Float64(x * Float64(x + 1.0)))); elseif (t <= -3.8e-259) tmp = Float64(Float64(y * z) / Float64(x * Float64(-1.0 - x))); elseif (t <= 2e-145) tmp = 1.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + (y / t)) / (x + 1.0); tmp = 0.0; if (t <= -2.4e-136) tmp = t_1; elseif (t <= -8.5e-229) tmp = 1.0 + ((z * t) / (x * (x + 1.0))); elseif (t <= -3.8e-259) tmp = (y * z) / (x * (-1.0 - x)); elseif (t <= 2e-145) tmp = 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.4e-136], t$95$1, If[LessEqual[t, -8.5e-229], N[(1.0 + N[(N[(z * t), $MachinePrecision] / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -3.8e-259], N[(N[(y * z), $MachinePrecision] / N[(x * N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2e-145], 1.0, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{if}\;t \leq -2.4 \cdot 10^{-136}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -8.5 \cdot 10^{-229}:\\
\;\;\;\;1 + \frac{z \cdot t}{x \cdot \left(x + 1\right)}\\
\mathbf{elif}\;t \leq -3.8 \cdot 10^{-259}:\\
\;\;\;\;\frac{y \cdot z}{x \cdot \left(-1 - x\right)}\\
\mathbf{elif}\;t \leq 2 \cdot 10^{-145}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.3999999999999999e-136 or 1.99999999999999983e-145 < t Initial program 90.8%
*-commutative90.8%
Simplified90.8%
Taylor expanded in z around inf 81.7%
if -2.3999999999999999e-136 < t < -8.49999999999999977e-229Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 74.4%
+-commutative74.4%
Simplified74.4%
Taylor expanded in t around 0 74.4%
if -8.49999999999999977e-229 < t < -3.8e-259Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 89.0%
associate-/l*89.0%
associate-/r*89.0%
+-commutative89.0%
Simplified89.0%
Taylor expanded in z around 0 78.0%
Taylor expanded in y around 0 78.0%
associate-*r/78.0%
mul-1-neg78.0%
distribute-rgt-neg-out78.0%
+-commutative78.0%
Simplified78.0%
if -3.8e-259 < t < 1.99999999999999983e-145Initial program 94.3%
*-commutative94.3%
Simplified94.3%
Taylor expanded in y around 0 68.5%
+-commutative68.5%
Simplified68.5%
Taylor expanded in x around inf 68.8%
Final simplification79.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ x (/ y t)) (+ x 1.0))))
(if (<= t -1.12e-138)
t_1
(if (<= t -8.5e-229)
1.0
(if (<= t -4e-259)
(/ (* y z) (* x (- -1.0 x)))
(if (<= t 4.6e-146) 1.0 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (x + (y / t)) / (x + 1.0);
double tmp;
if (t <= -1.12e-138) {
tmp = t_1;
} else if (t <= -8.5e-229) {
tmp = 1.0;
} else if (t <= -4e-259) {
tmp = (y * z) / (x * (-1.0 - x));
} else if (t <= 4.6e-146) {
tmp = 1.0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x + (y / t)) / (x + 1.0d0)
if (t <= (-1.12d-138)) then
tmp = t_1
else if (t <= (-8.5d-229)) then
tmp = 1.0d0
else if (t <= (-4d-259)) then
tmp = (y * z) / (x * ((-1.0d0) - x))
else if (t <= 4.6d-146) then
tmp = 1.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x + (y / t)) / (x + 1.0);
double tmp;
if (t <= -1.12e-138) {
tmp = t_1;
} else if (t <= -8.5e-229) {
tmp = 1.0;
} else if (t <= -4e-259) {
tmp = (y * z) / (x * (-1.0 - x));
} else if (t <= 4.6e-146) {
tmp = 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (y / t)) / (x + 1.0) tmp = 0 if t <= -1.12e-138: tmp = t_1 elif t <= -8.5e-229: tmp = 1.0 elif t <= -4e-259: tmp = (y * z) / (x * (-1.0 - x)) elif t <= 4.6e-146: tmp = 1.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)) tmp = 0.0 if (t <= -1.12e-138) tmp = t_1; elseif (t <= -8.5e-229) tmp = 1.0; elseif (t <= -4e-259) tmp = Float64(Float64(y * z) / Float64(x * Float64(-1.0 - x))); elseif (t <= 4.6e-146) tmp = 1.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + (y / t)) / (x + 1.0); tmp = 0.0; if (t <= -1.12e-138) tmp = t_1; elseif (t <= -8.5e-229) tmp = 1.0; elseif (t <= -4e-259) tmp = (y * z) / (x * (-1.0 - x)); elseif (t <= 4.6e-146) tmp = 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.12e-138], t$95$1, If[LessEqual[t, -8.5e-229], 1.0, If[LessEqual[t, -4e-259], N[(N[(y * z), $MachinePrecision] / N[(x * N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.6e-146], 1.0, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{if}\;t \leq -1.12 \cdot 10^{-138}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -8.5 \cdot 10^{-229}:\\
\;\;\;\;1\\
\mathbf{elif}\;t \leq -4 \cdot 10^{-259}:\\
\;\;\;\;\frac{y \cdot z}{x \cdot \left(-1 - x\right)}\\
\mathbf{elif}\;t \leq 4.6 \cdot 10^{-146}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.1199999999999999e-138 or 4.6000000000000001e-146 < t Initial program 90.8%
*-commutative90.8%
Simplified90.8%
Taylor expanded in z around inf 81.7%
if -1.1199999999999999e-138 < t < -8.49999999999999977e-229 or -4.0000000000000003e-259 < t < 4.6000000000000001e-146Initial program 96.2%
*-commutative96.2%
Simplified96.2%
Taylor expanded in y around 0 70.6%
+-commutative70.6%
Simplified70.6%
Taylor expanded in x around inf 70.4%
if -8.49999999999999977e-229 < t < -4.0000000000000003e-259Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 89.0%
associate-/l*89.0%
associate-/r*89.0%
+-commutative89.0%
Simplified89.0%
Taylor expanded in z around 0 78.0%
Taylor expanded in y around 0 78.0%
associate-*r/78.0%
mul-1-neg78.0%
distribute-rgt-neg-out78.0%
+-commutative78.0%
Simplified78.0%
Final simplification79.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ x (/ y t)) (+ x 1.0))))
(if (<= t -1.16e-132)
t_1
(if (<= t -9.2e-243)
1.0
(if (<= t -3.3e-260)
(* y (/ z (- (* z t) x)))
(if (<= t 7.8e-143) 1.0 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (x + (y / t)) / (x + 1.0);
double tmp;
if (t <= -1.16e-132) {
tmp = t_1;
} else if (t <= -9.2e-243) {
tmp = 1.0;
} else if (t <= -3.3e-260) {
tmp = y * (z / ((z * t) - x));
} else if (t <= 7.8e-143) {
tmp = 1.0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x + (y / t)) / (x + 1.0d0)
if (t <= (-1.16d-132)) then
tmp = t_1
else if (t <= (-9.2d-243)) then
tmp = 1.0d0
else if (t <= (-3.3d-260)) then
tmp = y * (z / ((z * t) - x))
else if (t <= 7.8d-143) then
tmp = 1.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x + (y / t)) / (x + 1.0);
double tmp;
if (t <= -1.16e-132) {
tmp = t_1;
} else if (t <= -9.2e-243) {
tmp = 1.0;
} else if (t <= -3.3e-260) {
tmp = y * (z / ((z * t) - x));
} else if (t <= 7.8e-143) {
tmp = 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (y / t)) / (x + 1.0) tmp = 0 if t <= -1.16e-132: tmp = t_1 elif t <= -9.2e-243: tmp = 1.0 elif t <= -3.3e-260: tmp = y * (z / ((z * t) - x)) elif t <= 7.8e-143: tmp = 1.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)) tmp = 0.0 if (t <= -1.16e-132) tmp = t_1; elseif (t <= -9.2e-243) tmp = 1.0; elseif (t <= -3.3e-260) tmp = Float64(y * Float64(z / Float64(Float64(z * t) - x))); elseif (t <= 7.8e-143) tmp = 1.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + (y / t)) / (x + 1.0); tmp = 0.0; if (t <= -1.16e-132) tmp = t_1; elseif (t <= -9.2e-243) tmp = 1.0; elseif (t <= -3.3e-260) tmp = y * (z / ((z * t) - x)); elseif (t <= 7.8e-143) tmp = 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.16e-132], t$95$1, If[LessEqual[t, -9.2e-243], 1.0, If[LessEqual[t, -3.3e-260], N[(y * N[(z / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.8e-143], 1.0, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{if}\;t \leq -1.16 \cdot 10^{-132}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -9.2 \cdot 10^{-243}:\\
\;\;\;\;1\\
\mathbf{elif}\;t \leq -3.3 \cdot 10^{-260}:\\
\;\;\;\;y \cdot \frac{z}{z \cdot t - x}\\
\mathbf{elif}\;t \leq 7.8 \cdot 10^{-143}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.1599999999999999e-132 or 7.80000000000000007e-143 < t Initial program 90.8%
*-commutative90.8%
Simplified90.8%
Taylor expanded in z around inf 81.7%
if -1.1599999999999999e-132 < t < -9.20000000000000001e-243 or -3.2999999999999997e-260 < t < 7.80000000000000007e-143Initial program 96.3%
*-commutative96.3%
Simplified96.3%
Taylor expanded in y around 0 69.4%
+-commutative69.4%
Simplified69.4%
Taylor expanded in x around inf 69.2%
if -9.20000000000000001e-243 < t < -3.2999999999999997e-260Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 87.6%
associate-/l*87.6%
associate-/r*87.6%
+-commutative87.6%
Simplified87.6%
Taylor expanded in x around 0 76.2%
Final simplification78.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (+ x 1.0))))
(if (<= t -4.2e+82)
t_1
(if (<= t -9e-243)
1.0
(if (<= t -3.8e-259)
(* y (/ z (- (* z t) x)))
(if (<= t 3.1e-24) 1.0 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x / (x + 1.0);
double tmp;
if (t <= -4.2e+82) {
tmp = t_1;
} else if (t <= -9e-243) {
tmp = 1.0;
} else if (t <= -3.8e-259) {
tmp = y * (z / ((z * t) - x));
} else if (t <= 3.1e-24) {
tmp = 1.0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x / (x + 1.0d0)
if (t <= (-4.2d+82)) then
tmp = t_1
else if (t <= (-9d-243)) then
tmp = 1.0d0
else if (t <= (-3.8d-259)) then
tmp = y * (z / ((z * t) - x))
else if (t <= 3.1d-24) then
tmp = 1.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x / (x + 1.0);
double tmp;
if (t <= -4.2e+82) {
tmp = t_1;
} else if (t <= -9e-243) {
tmp = 1.0;
} else if (t <= -3.8e-259) {
tmp = y * (z / ((z * t) - x));
} else if (t <= 3.1e-24) {
tmp = 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x / (x + 1.0) tmp = 0 if t <= -4.2e+82: tmp = t_1 elif t <= -9e-243: tmp = 1.0 elif t <= -3.8e-259: tmp = y * (z / ((z * t) - x)) elif t <= 3.1e-24: tmp = 1.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (t <= -4.2e+82) tmp = t_1; elseif (t <= -9e-243) tmp = 1.0; elseif (t <= -3.8e-259) tmp = Float64(y * Float64(z / Float64(Float64(z * t) - x))); elseif (t <= 3.1e-24) tmp = 1.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x / (x + 1.0); tmp = 0.0; if (t <= -4.2e+82) tmp = t_1; elseif (t <= -9e-243) tmp = 1.0; elseif (t <= -3.8e-259) tmp = y * (z / ((z * t) - x)); elseif (t <= 3.1e-24) tmp = 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -4.2e+82], t$95$1, If[LessEqual[t, -9e-243], 1.0, If[LessEqual[t, -3.8e-259], N[(y * N[(z / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.1e-24], 1.0, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{x + 1}\\
\mathbf{if}\;t \leq -4.2 \cdot 10^{+82}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -9 \cdot 10^{-243}:\\
\;\;\;\;1\\
\mathbf{elif}\;t \leq -3.8 \cdot 10^{-259}:\\
\;\;\;\;y \cdot \frac{z}{z \cdot t - x}\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{-24}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.2e82 or 3.1e-24 < t Initial program 91.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in t around inf 77.2%
+-commutative77.2%
Simplified77.2%
if -4.2e82 < t < -9.00000000000000035e-243 or -3.8e-259 < t < 3.1e-24Initial program 93.3%
*-commutative93.3%
Simplified93.3%
Taylor expanded in y around 0 58.7%
+-commutative58.7%
Simplified58.7%
Taylor expanded in x around inf 56.3%
if -9.00000000000000035e-243 < t < -3.8e-259Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 87.6%
associate-/l*87.6%
associate-/r*87.6%
+-commutative87.6%
Simplified87.6%
Taylor expanded in x around 0 76.2%
Final simplification67.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.65e+57) (not (<= t 1.05e-131))) (/ (+ x (/ y t)) (+ x 1.0)) (+ 1.0 (/ (* y (/ z x)) (- -1.0 x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.65e+57) || !(t <= 1.05e-131)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + ((y * (z / x)) / (-1.0 - x));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-2.65d+57)) .or. (.not. (t <= 1.05d-131))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 + ((y * (z / x)) / ((-1.0d0) - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.65e+57) || !(t <= 1.05e-131)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + ((y * (z / x)) / (-1.0 - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.65e+57) or not (t <= 1.05e-131): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 + ((y * (z / x)) / (-1.0 - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.65e+57) || !(t <= 1.05e-131)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 + Float64(Float64(y * Float64(z / x)) / Float64(-1.0 - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.65e+57) || ~((t <= 1.05e-131))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 + ((y * (z / x)) / (-1.0 - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.65e+57], N[Not[LessEqual[t, 1.05e-131]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.65 \cdot 10^{+57} \lor \neg \left(t \leq 1.05 \cdot 10^{-131}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y \cdot \frac{z}{x}}{-1 - x}\\
\end{array}
\end{array}
if t < -2.64999999999999993e57 or 1.04999999999999999e-131 < t Initial program 91.3%
*-commutative91.3%
Simplified91.3%
Taylor expanded in z around inf 87.9%
if -2.64999999999999993e57 < t < 1.04999999999999999e-131Initial program 94.0%
*-commutative94.0%
Simplified94.0%
Taylor expanded in t around 0 79.2%
associate-+r+79.2%
mul-1-neg79.2%
unsub-neg79.2%
+-commutative79.2%
associate-/l*82.2%
+-commutative82.2%
Simplified82.2%
div-sub82.2%
pow182.2%
pow182.2%
pow-div82.2%
metadata-eval82.2%
metadata-eval82.2%
Applied egg-rr82.2%
Final simplification85.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.2e+81) (not (<= t 6.2e-25))) (/ x (+ x 1.0)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.2e+81) || !(t <= 6.2e-25)) {
tmp = x / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-5.2d+81)) .or. (.not. (t <= 6.2d-25))) then
tmp = x / (x + 1.0d0)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.2e+81) || !(t <= 6.2e-25)) {
tmp = x / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.2e+81) or not (t <= 6.2e-25): tmp = x / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5.2e+81) || !(t <= 6.2e-25)) tmp = Float64(x / Float64(x + 1.0)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -5.2e+81) || ~((t <= 6.2e-25))) tmp = x / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5.2e+81], N[Not[LessEqual[t, 6.2e-25]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.2 \cdot 10^{+81} \lor \neg \left(t \leq 6.2 \cdot 10^{-25}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if t < -5.19999999999999984e81 or 6.19999999999999989e-25 < t Initial program 91.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in t around inf 77.2%
+-commutative77.2%
Simplified77.2%
if -5.19999999999999984e81 < t < 6.19999999999999989e-25Initial program 93.7%
*-commutative93.7%
Simplified93.7%
Taylor expanded in y around 0 55.8%
+-commutative55.8%
Simplified55.8%
Taylor expanded in x around inf 53.5%
Final simplification65.7%
(FPCore (x y z t) :precision binary64 (if (<= x -5.2e-97) 1.0 (if (<= x 1.15e-150) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.2e-97) {
tmp = 1.0;
} else if (x <= 1.15e-150) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-5.2d-97)) then
tmp = 1.0d0
else if (x <= 1.15d-150) then
tmp = y / t
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.2e-97) {
tmp = 1.0;
} else if (x <= 1.15e-150) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -5.2e-97: tmp = 1.0 elif x <= 1.15e-150: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -5.2e-97) tmp = 1.0; elseif (x <= 1.15e-150) tmp = Float64(y / t); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -5.2e-97) tmp = 1.0; elseif (x <= 1.15e-150) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -5.2e-97], 1.0, If[LessEqual[x, 1.15e-150], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{-97}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{-150}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -5.20000000000000014e-97 or 1.15000000000000001e-150 < x Initial program 92.8%
*-commutative92.8%
Simplified92.8%
Taylor expanded in y around 0 82.8%
+-commutative82.8%
Simplified82.8%
Taylor expanded in x around inf 73.3%
if -5.20000000000000014e-97 < x < 1.15000000000000001e-150Initial program 91.1%
*-commutative91.1%
Simplified91.1%
Taylor expanded in z around inf 70.9%
Taylor expanded in x around 0 50.7%
(FPCore (x y z t) :precision binary64 1.0)
double code(double x, double y, double z, double t) {
return 1.0;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0
end function
public static double code(double x, double y, double z, double t) {
return 1.0;
}
def code(x, y, z, t): return 1.0
function code(x, y, z, t) return 1.0 end
function tmp = code(x, y, z, t) tmp = 1.0; end
code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 92.3%
*-commutative92.3%
Simplified92.3%
Taylor expanded in y around 0 70.1%
+-commutative70.1%
Simplified70.1%
Taylor expanded in x around inf 55.1%
(FPCore (x y z t) :precision binary64 (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0);
}
def code(x, y, z, t): return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(y / Float64(t - Float64(x / z))) - Float64(x / Float64(Float64(t * z) - x)))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \left(\frac{y}{t - \frac{x}{z}} - \frac{x}{t \cdot z - x}\right)}{x + 1}
\end{array}
herbie shell --seed 2024098
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:alt
(/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))