
(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 11 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 (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))))
(if (<= t_1 -1e-12)
(/ y (* (+ x 1.0) (- t (/ x z))))
(if (<= t_1 5e+266) t_1 (- (/ x (+ x 1.0)) (/ y (* t (- -1.0 x))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= -1e-12) {
tmp = y / ((x + 1.0) * (t - (x / z)));
} else if (t_1 <= 5e+266) {
tmp = t_1;
} else {
tmp = (x / (x + 1.0)) - (y / (t * (-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) :: t_1
real(8) :: tmp
t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0d0)
if (t_1 <= (-1d-12)) then
tmp = y / ((x + 1.0d0) * (t - (x / z)))
else if (t_1 <= 5d+266) then
tmp = t_1
else
tmp = (x / (x + 1.0d0)) - (y / (t * ((-1.0d0) - x)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= -1e-12) {
tmp = y / ((x + 1.0) * (t - (x / z)));
} else if (t_1 <= 5e+266) {
tmp = t_1;
} else {
tmp = (x / (x + 1.0)) - (y / (t * (-1.0 - x)));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0) tmp = 0 if t_1 <= -1e-12: tmp = y / ((x + 1.0) * (t - (x / z))) elif t_1 <= 5e+266: tmp = t_1 else: tmp = (x / (x + 1.0)) - (y / (t * (-1.0 - x))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)) tmp = 0.0 if (t_1 <= -1e-12) tmp = Float64(y / Float64(Float64(x + 1.0) * Float64(t - Float64(x / z)))); elseif (t_1 <= 5e+266) tmp = t_1; else tmp = Float64(Float64(x / Float64(x + 1.0)) - Float64(y / Float64(t * Float64(-1.0 - x)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0); tmp = 0.0; if (t_1 <= -1e-12) tmp = y / ((x + 1.0) * (t - (x / z))); elseif (t_1 <= 5e+266) tmp = t_1; else tmp = (x / (x + 1.0)) - (y / (t * (-1.0 - x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-12], N[(y / N[(N[(x + 1.0), $MachinePrecision] * N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+266], t$95$1, N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(y / N[(t * N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-12}:\\
\;\;\;\;\frac{y}{\left(x + 1\right) \cdot \left(t - \frac{x}{z}\right)}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+266}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1} - \frac{y}{t \cdot \left(-1 - x\right)}\\
\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))) < -9.9999999999999998e-13Initial program 80.4%
*-commutative80.4%
Simplified80.4%
Taylor expanded in z around inf 80.4%
mul-1-neg80.4%
unsub-neg80.4%
Simplified80.4%
Taylor expanded in y around inf 96.6%
*-commutative96.6%
+-commutative96.6%
Simplified96.6%
if -9.9999999999999998e-13 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 4.9999999999999999e266Initial program 98.9%
if 4.9999999999999999e266 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 28.9%
*-commutative28.9%
Simplified28.9%
Taylor expanded in z around inf 89.7%
Taylor expanded in y around 0 89.8%
+-commutative89.8%
+-commutative89.8%
Simplified89.8%
Final simplification97.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (+ x 1.0))))
(if (<= x -1.45e-19)
t_1
(if (<= x -4.5e-89)
(/ y t)
(if (<= x -1.15e-122)
(* x (- 1.0 x))
(if (<= x 7e-8) (/ y (* t (+ x 1.0))) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x / (x + 1.0);
double tmp;
if (x <= -1.45e-19) {
tmp = t_1;
} else if (x <= -4.5e-89) {
tmp = y / t;
} else if (x <= -1.15e-122) {
tmp = x * (1.0 - x);
} else if (x <= 7e-8) {
tmp = y / (t * (x + 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 (x <= (-1.45d-19)) then
tmp = t_1
else if (x <= (-4.5d-89)) then
tmp = y / t
else if (x <= (-1.15d-122)) then
tmp = x * (1.0d0 - x)
else if (x <= 7d-8) then
tmp = y / (t * (x + 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 (x <= -1.45e-19) {
tmp = t_1;
} else if (x <= -4.5e-89) {
tmp = y / t;
} else if (x <= -1.15e-122) {
tmp = x * (1.0 - x);
} else if (x <= 7e-8) {
tmp = y / (t * (x + 1.0));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x / (x + 1.0) tmp = 0 if x <= -1.45e-19: tmp = t_1 elif x <= -4.5e-89: tmp = y / t elif x <= -1.15e-122: tmp = x * (1.0 - x) elif x <= 7e-8: tmp = y / (t * (x + 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 (x <= -1.45e-19) tmp = t_1; elseif (x <= -4.5e-89) tmp = Float64(y / t); elseif (x <= -1.15e-122) tmp = Float64(x * Float64(1.0 - x)); elseif (x <= 7e-8) tmp = Float64(y / Float64(t * Float64(x + 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 (x <= -1.45e-19) tmp = t_1; elseif (x <= -4.5e-89) tmp = y / t; elseif (x <= -1.15e-122) tmp = x * (1.0 - x); elseif (x <= 7e-8) tmp = y / (t * (x + 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[x, -1.45e-19], t$95$1, If[LessEqual[x, -4.5e-89], N[(y / t), $MachinePrecision], If[LessEqual[x, -1.15e-122], N[(x * N[(1.0 - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7e-8], N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -1.45 \cdot 10^{-19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -4.5 \cdot 10^{-89}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{elif}\;x \leq -1.15 \cdot 10^{-122}:\\
\;\;\;\;x \cdot \left(1 - x\right)\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-8}:\\
\;\;\;\;\frac{y}{t \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.45e-19 or 7.00000000000000048e-8 < x Initial program 90.6%
*-commutative90.6%
Simplified90.6%
Taylor expanded in t around inf 88.2%
+-commutative88.2%
Simplified88.2%
if -1.45e-19 < x < -4.4999999999999999e-89Initial program 93.7%
*-commutative93.7%
Simplified93.7%
Taylor expanded in z around inf 64.3%
Taylor expanded in x around 0 46.4%
if -4.4999999999999999e-89 < x < -1.15000000000000003e-122Initial program 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in t around inf 83.6%
+-commutative83.6%
Simplified83.6%
Taylor expanded in x around 0 83.6%
neg-mul-183.6%
Simplified83.6%
if -1.15000000000000003e-122 < x < 7.00000000000000048e-8Initial program 85.7%
*-commutative85.7%
Simplified85.7%
Taylor expanded in y around inf 50.0%
associate-/l*55.9%
+-commutative55.9%
Simplified55.9%
Taylor expanded in z around inf 57.7%
+-commutative57.7%
Simplified57.7%
Final simplification71.4%
(FPCore (x y z t)
:precision binary64
(if (or (<= x -3.8e-23)
(not
(or (<= x -5.5e-89) (and (not (<= x -1.66e-121)) (<= x 7.2e-10)))))
(/ x (+ x 1.0))
(/ y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.8e-23) || !((x <= -5.5e-89) || (!(x <= -1.66e-121) && (x <= 7.2e-10)))) {
tmp = x / (x + 1.0);
} else {
tmp = y / t;
}
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 <= (-3.8d-23)) .or. (.not. (x <= (-5.5d-89)) .or. (.not. (x <= (-1.66d-121))) .and. (x <= 7.2d-10))) then
tmp = x / (x + 1.0d0)
else
tmp = y / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.8e-23) || !((x <= -5.5e-89) || (!(x <= -1.66e-121) && (x <= 7.2e-10)))) {
tmp = x / (x + 1.0);
} else {
tmp = y / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.8e-23) or not ((x <= -5.5e-89) or (not (x <= -1.66e-121) and (x <= 7.2e-10))): tmp = x / (x + 1.0) else: tmp = y / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.8e-23) || !((x <= -5.5e-89) || (!(x <= -1.66e-121) && (x <= 7.2e-10)))) tmp = Float64(x / Float64(x + 1.0)); else tmp = Float64(y / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.8e-23) || ~(((x <= -5.5e-89) || (~((x <= -1.66e-121)) && (x <= 7.2e-10))))) tmp = x / (x + 1.0); else tmp = y / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.8e-23], N[Not[Or[LessEqual[x, -5.5e-89], And[N[Not[LessEqual[x, -1.66e-121]], $MachinePrecision], LessEqual[x, 7.2e-10]]]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{-23} \lor \neg \left(x \leq -5.5 \cdot 10^{-89} \lor \neg \left(x \leq -1.66 \cdot 10^{-121}\right) \land x \leq 7.2 \cdot 10^{-10}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t}\\
\end{array}
\end{array}
if x < -3.80000000000000011e-23 or -5.50000000000000012e-89 < x < -1.6600000000000001e-121 or 7.2e-10 < x Initial program 91.1%
*-commutative91.1%
Simplified91.1%
Taylor expanded in t around inf 88.0%
+-commutative88.0%
Simplified88.0%
if -3.80000000000000011e-23 < x < -5.50000000000000012e-89 or -1.6600000000000001e-121 < x < 7.2e-10Initial program 86.6%
*-commutative86.6%
Simplified86.6%
Taylor expanded in z around inf 72.8%
Taylor expanded in x around 0 56.3%
Final simplification71.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (+ x 1.0))))
(if (<= x -2.12e-16)
t_1
(if (<= x -8.6e-89)
(/ y t)
(if (<= x -1.65e-121)
(* x (- 1.0 x))
(if (<= x 7.5e-10) (/ y t) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x / (x + 1.0);
double tmp;
if (x <= -2.12e-16) {
tmp = t_1;
} else if (x <= -8.6e-89) {
tmp = y / t;
} else if (x <= -1.65e-121) {
tmp = x * (1.0 - x);
} else if (x <= 7.5e-10) {
tmp = y / t;
} 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 (x <= (-2.12d-16)) then
tmp = t_1
else if (x <= (-8.6d-89)) then
tmp = y / t
else if (x <= (-1.65d-121)) then
tmp = x * (1.0d0 - x)
else if (x <= 7.5d-10) then
tmp = y / t
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 (x <= -2.12e-16) {
tmp = t_1;
} else if (x <= -8.6e-89) {
tmp = y / t;
} else if (x <= -1.65e-121) {
tmp = x * (1.0 - x);
} else if (x <= 7.5e-10) {
tmp = y / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x / (x + 1.0) tmp = 0 if x <= -2.12e-16: tmp = t_1 elif x <= -8.6e-89: tmp = y / t elif x <= -1.65e-121: tmp = x * (1.0 - x) elif x <= 7.5e-10: tmp = y / t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (x <= -2.12e-16) tmp = t_1; elseif (x <= -8.6e-89) tmp = Float64(y / t); elseif (x <= -1.65e-121) tmp = Float64(x * Float64(1.0 - x)); elseif (x <= 7.5e-10) tmp = Float64(y / t); 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 (x <= -2.12e-16) tmp = t_1; elseif (x <= -8.6e-89) tmp = y / t; elseif (x <= -1.65e-121) tmp = x * (1.0 - x); elseif (x <= 7.5e-10) tmp = y / t; 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[x, -2.12e-16], t$95$1, If[LessEqual[x, -8.6e-89], N[(y / t), $MachinePrecision], If[LessEqual[x, -1.65e-121], N[(x * N[(1.0 - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.5e-10], N[(y / t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -2.12 \cdot 10^{-16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -8.6 \cdot 10^{-89}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{elif}\;x \leq -1.65 \cdot 10^{-121}:\\
\;\;\;\;x \cdot \left(1 - x\right)\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.1199999999999999e-16 or 7.49999999999999995e-10 < x Initial program 90.6%
*-commutative90.6%
Simplified90.6%
Taylor expanded in t around inf 88.2%
+-commutative88.2%
Simplified88.2%
if -2.1199999999999999e-16 < x < -8.59999999999999974e-89 or -1.65000000000000005e-121 < x < 7.49999999999999995e-10Initial program 86.6%
*-commutative86.6%
Simplified86.6%
Taylor expanded in z around inf 72.8%
Taylor expanded in x around 0 56.3%
if -8.59999999999999974e-89 < x < -1.65000000000000005e-121Initial program 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in t around inf 83.6%
+-commutative83.6%
Simplified83.6%
Taylor expanded in x around 0 83.6%
neg-mul-183.6%
Simplified83.6%
Final simplification71.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.2e-13) (not (<= x 7.2e-9))) (/ (+ x (/ x (- x (* z t)))) (+ x 1.0)) (/ (+ x (/ (- y (/ x z)) t)) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.2e-13) || !(x <= 7.2e-9)) {
tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
} else {
tmp = (x + ((y - (x / z)) / 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) :: tmp
if ((x <= (-3.2d-13)) .or. (.not. (x <= 7.2d-9))) then
tmp = (x + (x / (x - (z * t)))) / (x + 1.0d0)
else
tmp = (x + ((y - (x / z)) / t)) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.2e-13) || !(x <= 7.2e-9)) {
tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
} else {
tmp = (x + ((y - (x / z)) / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.2e-13) or not (x <= 7.2e-9): tmp = (x + (x / (x - (z * t)))) / (x + 1.0) else: tmp = (x + ((y - (x / z)) / t)) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.2e-13) || !(x <= 7.2e-9)) tmp = Float64(Float64(x + Float64(x / Float64(x - Float64(z * t)))) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(Float64(y - Float64(x / z)) / t)) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.2e-13) || ~((x <= 7.2e-9))) tmp = (x + (x / (x - (z * t)))) / (x + 1.0); else tmp = (x + ((y - (x / z)) / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.2e-13], N[Not[LessEqual[x, 7.2e-9]], $MachinePrecision]], N[(N[(x + N[(x / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-13} \lor \neg \left(x \leq 7.2 \cdot 10^{-9}\right):\\
\;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y - \frac{x}{z}}{t}}{x + 1}\\
\end{array}
\end{array}
if x < -3.2e-13 or 7.2e-9 < x Initial program 90.6%
*-commutative90.6%
Simplified90.6%
Taylor expanded in y around 0 90.1%
+-commutative90.1%
Simplified90.1%
if -3.2e-13 < x < 7.2e-9Initial program 87.3%
*-commutative87.3%
Simplified87.3%
Taylor expanded in t around inf 81.1%
associate--l+81.1%
associate-/r*78.0%
Simplified78.0%
Taylor expanded in t around 0 81.9%
Final simplification85.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5.6e-58) (not (<= x 125.0))) (/ (- (+ x 1.0) (* y (/ z x))) (+ x 1.0)) (/ (+ x (/ (- y (/ x z)) t)) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.6e-58) || !(x <= 125.0)) {
tmp = ((x + 1.0) - (y * (z / x))) / (x + 1.0);
} else {
tmp = (x + ((y - (x / z)) / 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) :: tmp
if ((x <= (-5.6d-58)) .or. (.not. (x <= 125.0d0))) then
tmp = ((x + 1.0d0) - (y * (z / x))) / (x + 1.0d0)
else
tmp = (x + ((y - (x / z)) / t)) / (x + 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.6e-58) || !(x <= 125.0)) {
tmp = ((x + 1.0) - (y * (z / x))) / (x + 1.0);
} else {
tmp = (x + ((y - (x / z)) / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5.6e-58) or not (x <= 125.0): tmp = ((x + 1.0) - (y * (z / x))) / (x + 1.0) else: tmp = (x + ((y - (x / z)) / t)) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5.6e-58) || !(x <= 125.0)) tmp = Float64(Float64(Float64(x + 1.0) - Float64(y * Float64(z / x))) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(Float64(y - Float64(x / z)) / t)) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -5.6e-58) || ~((x <= 125.0))) tmp = ((x + 1.0) - (y * (z / x))) / (x + 1.0); else tmp = (x + ((y - (x / z)) / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5.6e-58], N[Not[LessEqual[x, 125.0]], $MachinePrecision]], N[(N[(N[(x + 1.0), $MachinePrecision] - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.6 \cdot 10^{-58} \lor \neg \left(x \leq 125\right):\\
\;\;\;\;\frac{\left(x + 1\right) - y \cdot \frac{z}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y - \frac{x}{z}}{t}}{x + 1}\\
\end{array}
\end{array}
if x < -5.6000000000000001e-58 or 125 < x Initial program 90.3%
*-commutative90.3%
Simplified90.3%
Taylor expanded in t around 0 85.1%
associate-+r+85.1%
mul-1-neg85.1%
unsub-neg85.1%
+-commutative85.1%
associate-/l*89.1%
+-commutative89.1%
Simplified89.1%
if -5.6000000000000001e-58 < x < 125Initial program 87.4%
*-commutative87.4%
Simplified87.4%
Taylor expanded in t around inf 83.0%
associate--l+83.0%
associate-/r*79.7%
Simplified79.7%
Taylor expanded in t around 0 83.8%
Final simplification86.3%
(FPCore (x y z t) :precision binary64 (if (<= x -2700000.0) 1.0 (if (<= x 0.42) (/ (+ x (/ (- y (/ x z)) t)) (+ x 1.0)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2700000.0) {
tmp = 1.0;
} else if (x <= 0.42) {
tmp = (x + ((y - (x / z)) / t)) / (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 (x <= (-2700000.0d0)) then
tmp = 1.0d0
else if (x <= 0.42d0) then
tmp = (x + ((y - (x / z)) / t)) / (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 (x <= -2700000.0) {
tmp = 1.0;
} else if (x <= 0.42) {
tmp = (x + ((y - (x / z)) / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2700000.0: tmp = 1.0 elif x <= 0.42: tmp = (x + ((y - (x / z)) / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2700000.0) tmp = 1.0; elseif (x <= 0.42) tmp = Float64(Float64(x + Float64(Float64(y - Float64(x / z)) / t)) / Float64(x + 1.0)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2700000.0) tmp = 1.0; elseif (x <= 0.42) tmp = (x + ((y - (x / z)) / t)) / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2700000.0], 1.0, If[LessEqual[x, 0.42], N[(N[(x + N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2700000:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 0.42:\\
\;\;\;\;\frac{x + \frac{y - \frac{x}{z}}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.7e6 or 0.419999999999999984 < x Initial program 91.2%
*-commutative91.2%
Simplified91.2%
Taylor expanded in z around inf 78.5%
Taylor expanded in x around inf 90.2%
if -2.7e6 < x < 0.419999999999999984Initial program 86.8%
*-commutative86.8%
Simplified86.8%
Taylor expanded in t around inf 80.8%
associate--l+80.8%
associate-/r*77.7%
Simplified77.7%
Taylor expanded in t around 0 81.5%
Final simplification85.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.2e-180) (not (<= z 3.6e-74))) (/ (+ x (/ y t)) (+ x 1.0)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.2e-180) || !(z <= 3.6e-74)) {
tmp = (x + (y / t)) / (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 ((z <= (-7.2d-180)) .or. (.not. (z <= 3.6d-74))) then
tmp = (x + (y / t)) / (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 ((z <= -7.2e-180) || !(z <= 3.6e-74)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.2e-180) or not (z <= 3.6e-74): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.2e-180) || !(z <= 3.6e-74)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7.2e-180) || ~((z <= 3.6e-74))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.2e-180], N[Not[LessEqual[z, 3.6e-74]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{-180} \lor \neg \left(z \leq 3.6 \cdot 10^{-74}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < -7.1999999999999998e-180 or 3.6000000000000002e-74 < z Initial program 84.2%
*-commutative84.2%
Simplified84.2%
Taylor expanded in z around inf 85.8%
if -7.1999999999999998e-180 < z < 3.6000000000000002e-74Initial program 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in z around inf 50.9%
Taylor expanded in x around inf 68.6%
Final simplification80.8%
(FPCore (x y z t) :precision binary64 (if (<= z -8.2e-180) (- (/ x (+ x 1.0)) (/ y (* t (- -1.0 x)))) (if (<= z 4.6e-74) 1.0 (/ (+ x (/ y t)) (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -8.2e-180) {
tmp = (x / (x + 1.0)) - (y / (t * (-1.0 - x)));
} else if (z <= 4.6e-74) {
tmp = 1.0;
} 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) :: tmp
if (z <= (-8.2d-180)) then
tmp = (x / (x + 1.0d0)) - (y / (t * ((-1.0d0) - x)))
else if (z <= 4.6d-74) then
tmp = 1.0d0
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 tmp;
if (z <= -8.2e-180) {
tmp = (x / (x + 1.0)) - (y / (t * (-1.0 - x)));
} else if (z <= 4.6e-74) {
tmp = 1.0;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -8.2e-180: tmp = (x / (x + 1.0)) - (y / (t * (-1.0 - x))) elif z <= 4.6e-74: tmp = 1.0 else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -8.2e-180) tmp = Float64(Float64(x / Float64(x + 1.0)) - Float64(y / Float64(t * Float64(-1.0 - x)))); elseif (z <= 4.6e-74) tmp = 1.0; else tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -8.2e-180) tmp = (x / (x + 1.0)) - (y / (t * (-1.0 - x))); elseif (z <= 4.6e-74) tmp = 1.0; else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -8.2e-180], N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(y / N[(t * N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.6e-74], 1.0, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.2 \cdot 10^{-180}:\\
\;\;\;\;\frac{x}{x + 1} - \frac{y}{t \cdot \left(-1 - x\right)}\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-74}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\end{array}
\end{array}
if z < -8.2e-180Initial program 88.5%
*-commutative88.5%
Simplified88.5%
Taylor expanded in z around inf 83.5%
Taylor expanded in y around 0 83.5%
+-commutative83.5%
+-commutative83.5%
Simplified83.5%
if -8.2e-180 < z < 4.59999999999999961e-74Initial program 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in z around inf 50.9%
Taylor expanded in x around inf 68.6%
if 4.59999999999999961e-74 < z Initial program 78.6%
*-commutative78.6%
Simplified78.6%
Taylor expanded in z around inf 88.8%
Final simplification80.8%
(FPCore (x y z t) :precision binary64 (if (<= x -3.95e-13) 1.0 (if (<= x 7.2e-10) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.95e-13) {
tmp = 1.0;
} else if (x <= 7.2e-10) {
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 <= (-3.95d-13)) then
tmp = 1.0d0
else if (x <= 7.2d-10) 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 <= -3.95e-13) {
tmp = 1.0;
} else if (x <= 7.2e-10) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.95e-13: tmp = 1.0 elif x <= 7.2e-10: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.95e-13) tmp = 1.0; elseif (x <= 7.2e-10) 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 <= -3.95e-13) tmp = 1.0; elseif (x <= 7.2e-10) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.95e-13], 1.0, If[LessEqual[x, 7.2e-10], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.95 \cdot 10^{-13}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{-10}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -3.94999999999999983e-13 or 7.2e-10 < x Initial program 90.6%
*-commutative90.6%
Simplified90.6%
Taylor expanded in z around inf 78.2%
Taylor expanded in x around inf 88.7%
if -3.94999999999999983e-13 < x < 7.2e-10Initial program 87.3%
*-commutative87.3%
Simplified87.3%
Taylor expanded in z around inf 73.4%
Taylor expanded in x around 0 53.7%
Final simplification69.4%
(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 88.8%
*-commutative88.8%
Simplified88.8%
Taylor expanded in z around inf 75.6%
Taylor expanded in x around inf 46.9%
Final simplification46.9%
(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 2024089
(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)))