
(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 10 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 -5e+37)
(/ y (* (+ x 1.0) (- t (/ x z))))
(if (<= t_1 2e+274) t_1 (/ (+ x (/ y t)) (+ x 1.0))))))
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 <= -5e+37) {
tmp = y / ((x + 1.0) * (t - (x / z)));
} else if (t_1 <= 2e+274) {
tmp = t_1;
} 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) :: tmp
t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0d0)
if (t_1 <= (-5d+37)) then
tmp = y / ((x + 1.0d0) * (t - (x / z)))
else if (t_1 <= 2d+274) then
tmp = t_1
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 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= -5e+37) {
tmp = y / ((x + 1.0) * (t - (x / z)));
} else if (t_1 <= 2e+274) {
tmp = t_1;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
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 <= -5e+37: tmp = y / ((x + 1.0) * (t - (x / z))) elif t_1 <= 2e+274: tmp = t_1 else: tmp = (x + (y / t)) / (x + 1.0) 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 <= -5e+37) tmp = Float64(y / Float64(Float64(x + 1.0) * Float64(t - Float64(x / z)))); elseif (t_1 <= 2e+274) tmp = t_1; 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 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0); tmp = 0.0; if (t_1 <= -5e+37) tmp = y / ((x + 1.0) * (t - (x / z))); elseif (t_1 <= 2e+274) tmp = t_1; else tmp = (x + (y / t)) / (x + 1.0); 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, -5e+37], N[(y / N[(N[(x + 1.0), $MachinePrecision] * N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+274], t$95$1, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $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 -5 \cdot 10^{+37}:\\
\;\;\;\;\frac{y}{\left(x + 1\right) \cdot \left(t - \frac{x}{z}\right)}\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+274}:\\
\;\;\;\;t_1\\
\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 1)) < -4.99999999999999989e37Initial program 80.9%
*-commutative80.9%
Simplified80.9%
clear-num80.8%
inv-pow80.8%
Applied egg-rr80.8%
unpow-180.8%
*-commutative80.8%
*-commutative80.8%
Simplified80.8%
Taylor expanded in y around inf 80.8%
Taylor expanded in y around inf 80.6%
associate-/r*80.9%
associate-/l*99.7%
+-commutative99.7%
associate-/l/99.7%
div-sub99.7%
associate-/l*99.8%
*-inverses99.8%
/-rgt-identity99.8%
Simplified99.8%
if -4.99999999999999989e37 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 1.99999999999999984e274Initial program 99.9%
if 1.99999999999999984e274 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 11.2%
*-commutative11.2%
Simplified11.2%
Taylor expanded in z around inf 77.4%
Final simplification97.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (/ y t)))
(t_2 (- (* z t) x))
(t_3 (/ (+ x (/ 1.0 (/ t_2 (* y z)))) (+ x 1.0))))
(if (<= z -1.3e+55)
(/ (- t_1 (/ x (* z t))) (+ x 1.0))
(if (<= z -1.02e-188)
t_3
(if (<= z 8.8e-30)
(/ (- x (/ x t_2)) (+ x 1.0))
(if (<= z 2e+169) t_3 (/ t_1 (+ x 1.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (y / t);
double t_2 = (z * t) - x;
double t_3 = (x + (1.0 / (t_2 / (y * z)))) / (x + 1.0);
double tmp;
if (z <= -1.3e+55) {
tmp = (t_1 - (x / (z * t))) / (x + 1.0);
} else if (z <= -1.02e-188) {
tmp = t_3;
} else if (z <= 8.8e-30) {
tmp = (x - (x / t_2)) / (x + 1.0);
} else if (z <= 2e+169) {
tmp = t_3;
} else {
tmp = t_1 / (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) :: t_3
real(8) :: tmp
t_1 = x + (y / t)
t_2 = (z * t) - x
t_3 = (x + (1.0d0 / (t_2 / (y * z)))) / (x + 1.0d0)
if (z <= (-1.3d+55)) then
tmp = (t_1 - (x / (z * t))) / (x + 1.0d0)
else if (z <= (-1.02d-188)) then
tmp = t_3
else if (z <= 8.8d-30) then
tmp = (x - (x / t_2)) / (x + 1.0d0)
else if (z <= 2d+169) then
tmp = t_3
else
tmp = t_1 / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x + (y / t);
double t_2 = (z * t) - x;
double t_3 = (x + (1.0 / (t_2 / (y * z)))) / (x + 1.0);
double tmp;
if (z <= -1.3e+55) {
tmp = (t_1 - (x / (z * t))) / (x + 1.0);
} else if (z <= -1.02e-188) {
tmp = t_3;
} else if (z <= 8.8e-30) {
tmp = (x - (x / t_2)) / (x + 1.0);
} else if (z <= 2e+169) {
tmp = t_3;
} else {
tmp = t_1 / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (y / t) t_2 = (z * t) - x t_3 = (x + (1.0 / (t_2 / (y * z)))) / (x + 1.0) tmp = 0 if z <= -1.3e+55: tmp = (t_1 - (x / (z * t))) / (x + 1.0) elif z <= -1.02e-188: tmp = t_3 elif z <= 8.8e-30: tmp = (x - (x / t_2)) / (x + 1.0) elif z <= 2e+169: tmp = t_3 else: tmp = t_1 / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(y / t)) t_2 = Float64(Float64(z * t) - x) t_3 = Float64(Float64(x + Float64(1.0 / Float64(t_2 / Float64(y * z)))) / Float64(x + 1.0)) tmp = 0.0 if (z <= -1.3e+55) tmp = Float64(Float64(t_1 - Float64(x / Float64(z * t))) / Float64(x + 1.0)); elseif (z <= -1.02e-188) tmp = t_3; elseif (z <= 8.8e-30) tmp = Float64(Float64(x - Float64(x / t_2)) / Float64(x + 1.0)); elseif (z <= 2e+169) tmp = t_3; else tmp = Float64(t_1 / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (y / t); t_2 = (z * t) - x; t_3 = (x + (1.0 / (t_2 / (y * z)))) / (x + 1.0); tmp = 0.0; if (z <= -1.3e+55) tmp = (t_1 - (x / (z * t))) / (x + 1.0); elseif (z <= -1.02e-188) tmp = t_3; elseif (z <= 8.8e-30) tmp = (x - (x / t_2)) / (x + 1.0); elseif (z <= 2e+169) tmp = t_3; else tmp = t_1 / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x + N[(1.0 / N[(t$95$2 / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.3e+55], N[(N[(t$95$1 - N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.02e-188], t$95$3, If[LessEqual[z, 8.8e-30], N[(N[(x - N[(x / t$95$2), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2e+169], t$95$3, N[(t$95$1 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y}{t}\\
t_2 := z \cdot t - x\\
t_3 := \frac{x + \frac{1}{\frac{t_2}{y \cdot z}}}{x + 1}\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{+55}:\\
\;\;\;\;\frac{t_1 - \frac{x}{z \cdot t}}{x + 1}\\
\mathbf{elif}\;z \leq -1.02 \cdot 10^{-188}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq 8.8 \cdot 10^{-30}:\\
\;\;\;\;\frac{x - \frac{x}{t_2}}{x + 1}\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+169}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{x + 1}\\
\end{array}
\end{array}
if z < -1.3e55Initial program 75.4%
*-commutative75.4%
Simplified75.4%
Taylor expanded in t around inf 87.7%
if -1.3e55 < z < -1.02e-188 or 8.79999999999999933e-30 < z < 1.99999999999999987e169Initial program 98.9%
*-commutative98.9%
Simplified98.9%
clear-num98.9%
inv-pow98.9%
Applied egg-rr98.9%
unpow-198.9%
*-commutative98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in y around inf 93.5%
if -1.02e-188 < z < 8.79999999999999933e-30Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 82.4%
+-commutative82.4%
Simplified82.4%
if 1.99999999999999987e169 < z Initial program 61.7%
*-commutative61.7%
Simplified61.7%
Taylor expanded in z around inf 87.2%
Final simplification87.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.85e-60) (not (<= t 45000000000000.0))) (/ (+ x (/ y t)) (+ x 1.0)) (- 1.0 (* (/ y (+ x 1.0)) (/ z x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.85e-60) || !(t <= 45000000000000.0)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((y / (x + 1.0)) * (z / 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 <= (-1.85d-60)) .or. (.not. (t <= 45000000000000.0d0))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 - ((y / (x + 1.0d0)) * (z / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.85e-60) || !(t <= 45000000000000.0)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((y / (x + 1.0)) * (z / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.85e-60) or not (t <= 45000000000000.0): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 - ((y / (x + 1.0)) * (z / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.85e-60) || !(t <= 45000000000000.0)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 - Float64(Float64(y / Float64(x + 1.0)) * Float64(z / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.85e-60) || ~((t <= 45000000000000.0))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 - ((y / (x + 1.0)) * (z / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.85e-60], N[Not[LessEqual[t, 45000000000000.0]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.85 \cdot 10^{-60} \lor \neg \left(t \leq 45000000000000\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y}{x + 1} \cdot \frac{z}{x}\\
\end{array}
\end{array}
if t < -1.85000000000000012e-60 or 4.5e13 < t Initial program 88.1%
*-commutative88.1%
Simplified88.1%
Taylor expanded in z around inf 88.0%
if -1.85000000000000012e-60 < t < 4.5e13Initial program 91.3%
*-commutative91.3%
Simplified91.3%
Taylor expanded in t around 0 71.6%
+-commutative71.6%
mul-1-neg71.6%
unsub-neg71.6%
associate-/l*77.1%
+-commutative77.1%
Simplified77.1%
Taylor expanded in y around 0 71.5%
mul-1-neg71.5%
unsub-neg71.5%
times-frac77.8%
Simplified77.8%
Final simplification83.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.3e+18) (not (<= x 1.4e+56))) (- 1.0 (* (/ z x) (/ y x))) (/ (+ x (/ y t)) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.3e+18) || !(x <= 1.4e+56)) {
tmp = 1.0 - ((z / x) * (y / x));
} 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 ((x <= (-4.3d+18)) .or. (.not. (x <= 1.4d+56))) then
tmp = 1.0d0 - ((z / x) * (y / x))
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 ((x <= -4.3e+18) || !(x <= 1.4e+56)) {
tmp = 1.0 - ((z / x) * (y / x));
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.3e+18) or not (x <= 1.4e+56): tmp = 1.0 - ((z / x) * (y / x)) else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.3e+18) || !(x <= 1.4e+56)) tmp = Float64(1.0 - Float64(Float64(z / x) * Float64(y / x))); 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 ((x <= -4.3e+18) || ~((x <= 1.4e+56))) tmp = 1.0 - ((z / x) * (y / x)); else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.3e+18], N[Not[LessEqual[x, 1.4e+56]], $MachinePrecision]], N[(1.0 - N[(N[(z / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.3 \cdot 10^{+18} \lor \neg \left(x \leq 1.4 \cdot 10^{+56}\right):\\
\;\;\;\;1 - \frac{z}{x} \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\end{array}
\end{array}
if x < -4.3e18 or 1.40000000000000004e56 < x Initial program 90.0%
*-commutative90.0%
Simplified90.0%
Taylor expanded in x around -inf 77.9%
mul-1-neg77.9%
unsub-neg77.9%
distribute-rgt-out--77.9%
unpow277.9%
Simplified77.9%
Taylor expanded in y around inf 87.6%
unpow287.6%
times-frac96.0%
Simplified96.0%
if -4.3e18 < x < 1.40000000000000004e56Initial program 89.4%
*-commutative89.4%
Simplified89.4%
Taylor expanded in z around inf 63.1%
Final simplification78.1%
(FPCore (x y z t) :precision binary64 (if (<= x -1.25e-5) 1.0 (if (<= x 7e-63) (/ y (* t (+ x 1.0))) (/ x (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.25e-5) {
tmp = 1.0;
} else if (x <= 7e-63) {
tmp = y / (t * (x + 1.0));
} else {
tmp = x / (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 <= (-1.25d-5)) then
tmp = 1.0d0
else if (x <= 7d-63) then
tmp = y / (t * (x + 1.0d0))
else
tmp = x / (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 <= -1.25e-5) {
tmp = 1.0;
} else if (x <= 7e-63) {
tmp = y / (t * (x + 1.0));
} else {
tmp = x / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.25e-5: tmp = 1.0 elif x <= 7e-63: tmp = y / (t * (x + 1.0)) else: tmp = x / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.25e-5) tmp = 1.0; elseif (x <= 7e-63) tmp = Float64(y / Float64(t * Float64(x + 1.0))); else tmp = Float64(x / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.25e-5) tmp = 1.0; elseif (x <= 7e-63) tmp = y / (t * (x + 1.0)); else tmp = x / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.25e-5], 1.0, If[LessEqual[x, 7e-63], N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{-5}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-63}:\\
\;\;\;\;\frac{y}{t \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1}\\
\end{array}
\end{array}
if x < -1.25000000000000006e-5Initial program 89.9%
*-commutative89.9%
Simplified89.9%
clear-num89.9%
inv-pow89.9%
Applied egg-rr89.9%
unpow-189.9%
*-commutative89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in y around inf 88.6%
Taylor expanded in x around inf 86.8%
if -1.25000000000000006e-5 < x < 7.00000000000000006e-63Initial program 89.7%
*-commutative89.7%
Simplified89.7%
Taylor expanded in t around inf 69.7%
Taylor expanded in y around inf 49.3%
if 7.00000000000000006e-63 < x Initial program 89.2%
*-commutative89.2%
Simplified89.2%
Taylor expanded in t around inf 81.2%
+-commutative81.2%
Simplified81.2%
Final simplification68.4%
(FPCore (x y z t) :precision binary64 (if (<= x -1.5e-5) 1.0 (if (<= x 8.5e-70) (/ (/ y (+ x 1.0)) t) (/ x (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.5e-5) {
tmp = 1.0;
} else if (x <= 8.5e-70) {
tmp = (y / (x + 1.0)) / t;
} else {
tmp = x / (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 <= (-1.5d-5)) then
tmp = 1.0d0
else if (x <= 8.5d-70) then
tmp = (y / (x + 1.0d0)) / t
else
tmp = x / (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 <= -1.5e-5) {
tmp = 1.0;
} else if (x <= 8.5e-70) {
tmp = (y / (x + 1.0)) / t;
} else {
tmp = x / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.5e-5: tmp = 1.0 elif x <= 8.5e-70: tmp = (y / (x + 1.0)) / t else: tmp = x / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.5e-5) tmp = 1.0; elseif (x <= 8.5e-70) tmp = Float64(Float64(y / Float64(x + 1.0)) / t); else tmp = Float64(x / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.5e-5) tmp = 1.0; elseif (x <= 8.5e-70) tmp = (y / (x + 1.0)) / t; else tmp = x / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.5e-5], 1.0, If[LessEqual[x, 8.5e-70], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-5}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{-70}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1}\\
\end{array}
\end{array}
if x < -1.50000000000000004e-5Initial program 89.9%
*-commutative89.9%
Simplified89.9%
clear-num89.9%
inv-pow89.9%
Applied egg-rr89.9%
unpow-189.9%
*-commutative89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in y around inf 88.6%
Taylor expanded in x around inf 86.8%
if -1.50000000000000004e-5 < x < 8.5000000000000002e-70Initial program 89.7%
*-commutative89.7%
Simplified89.7%
Taylor expanded in t around inf 69.7%
Taylor expanded in t around 0 57.1%
Taylor expanded in y around inf 49.3%
associate-/r*49.3%
+-commutative49.3%
Simplified49.3%
if 8.5000000000000002e-70 < x Initial program 89.2%
*-commutative89.2%
Simplified89.2%
Taylor expanded in t around inf 81.2%
+-commutative81.2%
Simplified81.2%
Final simplification68.4%
(FPCore (x y z t) :precision binary64 (if (<= x -0.0042) (- 1.0 (* (/ z x) (/ y x))) (if (<= x 2e-77) (/ (/ y (+ x 1.0)) t) (/ x (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.0042) {
tmp = 1.0 - ((z / x) * (y / x));
} else if (x <= 2e-77) {
tmp = (y / (x + 1.0)) / t;
} else {
tmp = x / (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 <= (-0.0042d0)) then
tmp = 1.0d0 - ((z / x) * (y / x))
else if (x <= 2d-77) then
tmp = (y / (x + 1.0d0)) / t
else
tmp = x / (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 <= -0.0042) {
tmp = 1.0 - ((z / x) * (y / x));
} else if (x <= 2e-77) {
tmp = (y / (x + 1.0)) / t;
} else {
tmp = x / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -0.0042: tmp = 1.0 - ((z / x) * (y / x)) elif x <= 2e-77: tmp = (y / (x + 1.0)) / t else: tmp = x / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -0.0042) tmp = Float64(1.0 - Float64(Float64(z / x) * Float64(y / x))); elseif (x <= 2e-77) tmp = Float64(Float64(y / Float64(x + 1.0)) / t); else tmp = Float64(x / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -0.0042) tmp = 1.0 - ((z / x) * (y / x)); elseif (x <= 2e-77) tmp = (y / (x + 1.0)) / t; else tmp = x / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -0.0042], N[(1.0 - N[(N[(z / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2e-77], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0042:\\
\;\;\;\;1 - \frac{z}{x} \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-77}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1}\\
\end{array}
\end{array}
if x < -0.00419999999999999974Initial program 89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in x around -inf 77.3%
mul-1-neg77.3%
unsub-neg77.3%
distribute-rgt-out--77.3%
unpow277.3%
Simplified77.3%
Taylor expanded in y around inf 85.9%
unpow285.9%
times-frac93.5%
Simplified93.5%
if -0.00419999999999999974 < x < 1.9999999999999999e-77Initial program 89.7%
*-commutative89.7%
Simplified89.7%
Taylor expanded in t around inf 69.7%
Taylor expanded in t around 0 57.1%
Taylor expanded in y around inf 49.3%
associate-/r*49.3%
+-commutative49.3%
Simplified49.3%
if 1.9999999999999999e-77 < x Initial program 89.2%
*-commutative89.2%
Simplified89.2%
Taylor expanded in t around inf 81.2%
+-commutative81.2%
Simplified81.2%
Final simplification70.5%
(FPCore (x y z t) :precision binary64 (if (<= x -1.25e-5) 1.0 (if (<= x 7.5e-67) (/ y t) (/ x (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.25e-5) {
tmp = 1.0;
} else if (x <= 7.5e-67) {
tmp = y / t;
} else {
tmp = x / (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 <= (-1.25d-5)) then
tmp = 1.0d0
else if (x <= 7.5d-67) then
tmp = y / t
else
tmp = x / (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 <= -1.25e-5) {
tmp = 1.0;
} else if (x <= 7.5e-67) {
tmp = y / t;
} else {
tmp = x / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.25e-5: tmp = 1.0 elif x <= 7.5e-67: tmp = y / t else: tmp = x / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.25e-5) tmp = 1.0; elseif (x <= 7.5e-67) tmp = Float64(y / t); else tmp = Float64(x / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.25e-5) tmp = 1.0; elseif (x <= 7.5e-67) tmp = y / t; else tmp = x / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.25e-5], 1.0, If[LessEqual[x, 7.5e-67], N[(y / t), $MachinePrecision], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{-5}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-67}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1}\\
\end{array}
\end{array}
if x < -1.25000000000000006e-5Initial program 89.9%
*-commutative89.9%
Simplified89.9%
clear-num89.9%
inv-pow89.9%
Applied egg-rr89.9%
unpow-189.9%
*-commutative89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in y around inf 88.6%
Taylor expanded in x around inf 86.8%
if -1.25000000000000006e-5 < x < 7.5000000000000005e-67Initial program 89.7%
*-commutative89.7%
Simplified89.7%
Taylor expanded in t around inf 69.7%
Taylor expanded in y around inf 49.3%
Taylor expanded in x around 0 49.1%
if 7.5000000000000005e-67 < x Initial program 89.2%
*-commutative89.2%
Simplified89.2%
Taylor expanded in t around inf 81.2%
+-commutative81.2%
Simplified81.2%
Final simplification68.3%
(FPCore (x y z t) :precision binary64 (if (<= x -1.25e-5) 1.0 (if (<= x 7.1e-40) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.25e-5) {
tmp = 1.0;
} else if (x <= 7.1e-40) {
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 <= (-1.25d-5)) then
tmp = 1.0d0
else if (x <= 7.1d-40) 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 <= -1.25e-5) {
tmp = 1.0;
} else if (x <= 7.1e-40) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.25e-5: tmp = 1.0 elif x <= 7.1e-40: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.25e-5) tmp = 1.0; elseif (x <= 7.1e-40) 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 <= -1.25e-5) tmp = 1.0; elseif (x <= 7.1e-40) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.25e-5], 1.0, If[LessEqual[x, 7.1e-40], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{-5}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 7.1 \cdot 10^{-40}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.25000000000000006e-5 or 7.10000000000000023e-40 < x Initial program 89.2%
*-commutative89.2%
Simplified89.2%
clear-num89.2%
inv-pow89.2%
Applied egg-rr89.2%
unpow-189.2%
*-commutative89.2%
*-commutative89.2%
Simplified89.2%
Taylor expanded in y around inf 86.2%
Taylor expanded in x around inf 86.4%
if -1.25000000000000006e-5 < x < 7.10000000000000023e-40Initial program 90.2%
*-commutative90.2%
Simplified90.2%
Taylor expanded in t around inf 70.1%
Taylor expanded in y around inf 48.3%
Taylor expanded in x around 0 48.1%
Final simplification68.3%
(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 89.7%
*-commutative89.7%
Simplified89.7%
clear-num89.6%
inv-pow89.6%
Applied egg-rr89.6%
unpow-189.6%
*-commutative89.6%
*-commutative89.6%
Simplified89.6%
Taylor expanded in y around inf 76.4%
Taylor expanded in x around inf 53.7%
Final simplification53.7%
(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 2023185
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:herbie-target
(/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))