
(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 8 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 (/ (- x (* y z)) t_1)) (+ x 1.0))))
(if (<= t_2 -50000000000000.0)
(* y (/ z (* t_1 (+ x 1.0))))
(if (<= t_2 1e-68)
(/ (- x (/ (- (/ x z) y) t)) (+ x 1.0))
(if (<= t_2 1e+299)
t_2
(+
(/ x (+ x 1.0))
(/ (- (/ y (+ x 1.0)) (/ x (* z (+ x 1.0)))) t)))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -50000000000000.0) {
tmp = y * (z / (t_1 * (x + 1.0)));
} else if (t_2 <= 1e-68) {
tmp = (x - (((x / z) - y) / t)) / (x + 1.0);
} else if (t_2 <= 1e+299) {
tmp = t_2;
} else {
tmp = (x / (x + 1.0)) + (((y / (x + 1.0)) - (x / (z * (x + 1.0)))) / 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z * t) - x
t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0d0)
if (t_2 <= (-50000000000000.0d0)) then
tmp = y * (z / (t_1 * (x + 1.0d0)))
else if (t_2 <= 1d-68) then
tmp = (x - (((x / z) - y) / t)) / (x + 1.0d0)
else if (t_2 <= 1d+299) then
tmp = t_2
else
tmp = (x / (x + 1.0d0)) + (((y / (x + 1.0d0)) - (x / (z * (x + 1.0d0)))) / t)
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 - ((x - (y * z)) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -50000000000000.0) {
tmp = y * (z / (t_1 * (x + 1.0)));
} else if (t_2 <= 1e-68) {
tmp = (x - (((x / z) - y) / t)) / (x + 1.0);
} else if (t_2 <= 1e+299) {
tmp = t_2;
} else {
tmp = (x / (x + 1.0)) + (((y / (x + 1.0)) - (x / (z * (x + 1.0)))) / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * t) - x t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0) tmp = 0 if t_2 <= -50000000000000.0: tmp = y * (z / (t_1 * (x + 1.0))) elif t_2 <= 1e-68: tmp = (x - (((x / z) - y) / t)) / (x + 1.0) elif t_2 <= 1e+299: tmp = t_2 else: tmp = (x / (x + 1.0)) + (((y / (x + 1.0)) - (x / (z * (x + 1.0)))) / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) t_2 = Float64(Float64(x - Float64(Float64(x - Float64(y * z)) / t_1)) / Float64(x + 1.0)) tmp = 0.0 if (t_2 <= -50000000000000.0) tmp = Float64(y * Float64(z / Float64(t_1 * Float64(x + 1.0)))); elseif (t_2 <= 1e-68) tmp = Float64(Float64(x - Float64(Float64(Float64(x / z) - y) / t)) / Float64(x + 1.0)); elseif (t_2 <= 1e+299) tmp = t_2; else tmp = Float64(Float64(x / Float64(x + 1.0)) + Float64(Float64(Float64(y / Float64(x + 1.0)) - Float64(x / Float64(z * Float64(x + 1.0)))) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * t) - x; t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0); tmp = 0.0; if (t_2 <= -50000000000000.0) tmp = y * (z / (t_1 * (x + 1.0))); elseif (t_2 <= 1e-68) tmp = (x - (((x / z) - y) / t)) / (x + 1.0); elseif (t_2 <= 1e+299) tmp = t_2; else tmp = (x / (x + 1.0)) + (((y / (x + 1.0)) - (x / (z * (x + 1.0)))) / t); 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[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -50000000000000.0], N[(y * N[(z / N[(t$95$1 * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e-68], N[(N[(x - N[(N[(N[(x / z), $MachinePrecision] - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+299], t$95$2, N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(x / N[(z * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t - x\\
t_2 := \frac{x - \frac{x - y \cdot z}{t\_1}}{x + 1}\\
\mathbf{if}\;t\_2 \leq -50000000000000:\\
\;\;\;\;y \cdot \frac{z}{t\_1 \cdot \left(x + 1\right)}\\
\mathbf{elif}\;t\_2 \leq 10^{-68}:\\
\;\;\;\;\frac{x - \frac{\frac{x}{z} - y}{t}}{x + 1}\\
\mathbf{elif}\;t\_2 \leq 10^{+299}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1} + \frac{\frac{y}{x + 1} - \frac{x}{z \cdot \left(x + 1\right)}}{t}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -5e13Initial program 78.0%
*-commutative78.0%
Simplified78.0%
Taylor expanded in y around inf 77.5%
associate-/l*90.2%
+-commutative90.2%
Simplified90.2%
if -5e13 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 1.00000000000000007e-68Initial program 92.0%
*-commutative92.0%
Simplified92.0%
Taylor expanded in t around -inf 99.9%
mul-1-neg99.9%
distribute-lft-out--99.9%
Simplified99.9%
if 1.00000000000000007e-68 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 1.0000000000000001e299Initial program 99.9%
if 1.0000000000000001e299 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 23.0%
*-commutative23.0%
Simplified23.0%
Taylor expanded in t around -inf 82.9%
+-commutative82.9%
mul-1-neg82.9%
unsub-neg82.9%
+-commutative82.9%
sub-neg82.9%
mul-1-neg82.9%
distribute-neg-frac282.9%
distribute-neg-in82.9%
metadata-eval82.9%
unsub-neg82.9%
mul-1-neg82.9%
remove-double-neg82.9%
+-commutative82.9%
Simplified82.9%
Final simplification97.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z t) x)) (t_2 (/ (- x (/ (- x (* y z)) t_1)) (+ x 1.0))))
(if (<= t_2 -50000000000000.0)
(* y (/ z (* t_1 (+ x 1.0))))
(if (<= t_2 1e-68)
(/ (- x (/ (- (/ x z) y) t)) (+ x 1.0))
(if (<= t_2 1e+299) t_2 (* (+ x (/ y t)) (/ 1.0 (+ x 1.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -50000000000000.0) {
tmp = y * (z / (t_1 * (x + 1.0)));
} else if (t_2 <= 1e-68) {
tmp = (x - (((x / z) - y) / t)) / (x + 1.0);
} else if (t_2 <= 1e+299) {
tmp = t_2;
} else {
tmp = (x + (y / t)) * (1.0 / (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 - ((x - (y * z)) / t_1)) / (x + 1.0d0)
if (t_2 <= (-50000000000000.0d0)) then
tmp = y * (z / (t_1 * (x + 1.0d0)))
else if (t_2 <= 1d-68) then
tmp = (x - (((x / z) - y) / t)) / (x + 1.0d0)
else if (t_2 <= 1d+299) then
tmp = t_2
else
tmp = (x + (y / t)) * (1.0d0 / (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 - ((x - (y * z)) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -50000000000000.0) {
tmp = y * (z / (t_1 * (x + 1.0)));
} else if (t_2 <= 1e-68) {
tmp = (x - (((x / z) - y) / t)) / (x + 1.0);
} else if (t_2 <= 1e+299) {
tmp = t_2;
} else {
tmp = (x + (y / t)) * (1.0 / (x + 1.0));
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * t) - x t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0) tmp = 0 if t_2 <= -50000000000000.0: tmp = y * (z / (t_1 * (x + 1.0))) elif t_2 <= 1e-68: tmp = (x - (((x / z) - y) / t)) / (x + 1.0) elif t_2 <= 1e+299: tmp = t_2 else: tmp = (x + (y / t)) * (1.0 / (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(x - Float64(y * z)) / t_1)) / Float64(x + 1.0)) tmp = 0.0 if (t_2 <= -50000000000000.0) tmp = Float64(y * Float64(z / Float64(t_1 * Float64(x + 1.0)))); elseif (t_2 <= 1e-68) tmp = Float64(Float64(x - Float64(Float64(Float64(x / z) - y) / t)) / Float64(x + 1.0)); elseif (t_2 <= 1e+299) tmp = t_2; else tmp = Float64(Float64(x + Float64(y / t)) * Float64(1.0 / Float64(x + 1.0))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * t) - x; t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0); tmp = 0.0; if (t_2 <= -50000000000000.0) tmp = y * (z / (t_1 * (x + 1.0))); elseif (t_2 <= 1e-68) tmp = (x - (((x / z) - y) / t)) / (x + 1.0); elseif (t_2 <= 1e+299) tmp = t_2; else tmp = (x + (y / t)) * (1.0 / (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[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -50000000000000.0], N[(y * N[(z / N[(t$95$1 * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e-68], N[(N[(x - N[(N[(N[(x / z), $MachinePrecision] - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+299], t$95$2, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t - x\\
t_2 := \frac{x - \frac{x - y \cdot z}{t\_1}}{x + 1}\\
\mathbf{if}\;t\_2 \leq -50000000000000:\\
\;\;\;\;y \cdot \frac{z}{t\_1 \cdot \left(x + 1\right)}\\
\mathbf{elif}\;t\_2 \leq 10^{-68}:\\
\;\;\;\;\frac{x - \frac{\frac{x}{z} - y}{t}}{x + 1}\\
\mathbf{elif}\;t\_2 \leq 10^{+299}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\left(x + \frac{y}{t}\right) \cdot \frac{1}{x + 1}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -5e13Initial program 78.0%
*-commutative78.0%
Simplified78.0%
Taylor expanded in y around inf 77.5%
associate-/l*90.2%
+-commutative90.2%
Simplified90.2%
if -5e13 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 1.00000000000000007e-68Initial program 92.0%
*-commutative92.0%
Simplified92.0%
Taylor expanded in t around -inf 99.9%
mul-1-neg99.9%
distribute-lft-out--99.9%
Simplified99.9%
if 1.00000000000000007e-68 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 1.0000000000000001e299Initial program 99.9%
if 1.0000000000000001e299 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 23.0%
*-commutative23.0%
Simplified23.0%
Taylor expanded in z around inf 82.7%
div-inv82.7%
Applied egg-rr82.7%
Final simplification97.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (+ x 1.0))))
(if (<= x -1.35e-65)
t_1
(if (<= x 2.7e-86)
(/ y t)
(if (<= x 8e-37) t_1 (if (<= x 1.45e-18) (/ y t) 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = x / (x + 1.0);
double tmp;
if (x <= -1.35e-65) {
tmp = t_1;
} else if (x <= 2.7e-86) {
tmp = y / t;
} else if (x <= 8e-37) {
tmp = t_1;
} else if (x <= 1.45e-18) {
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) :: t_1
real(8) :: tmp
t_1 = x / (x + 1.0d0)
if (x <= (-1.35d-65)) then
tmp = t_1
else if (x <= 2.7d-86) then
tmp = y / t
else if (x <= 8d-37) then
tmp = t_1
else if (x <= 1.45d-18) 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 t_1 = x / (x + 1.0);
double tmp;
if (x <= -1.35e-65) {
tmp = t_1;
} else if (x <= 2.7e-86) {
tmp = y / t;
} else if (x <= 8e-37) {
tmp = t_1;
} else if (x <= 1.45e-18) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = x / (x + 1.0) tmp = 0 if x <= -1.35e-65: tmp = t_1 elif x <= 2.7e-86: tmp = y / t elif x <= 8e-37: tmp = t_1 elif x <= 1.45e-18: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) t_1 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (x <= -1.35e-65) tmp = t_1; elseif (x <= 2.7e-86) tmp = Float64(y / t); elseif (x <= 8e-37) tmp = t_1; elseif (x <= 1.45e-18) tmp = Float64(y / t); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x / (x + 1.0); tmp = 0.0; if (x <= -1.35e-65) tmp = t_1; elseif (x <= 2.7e-86) tmp = y / t; elseif (x <= 8e-37) tmp = t_1; elseif (x <= 1.45e-18) tmp = y / t; else tmp = 1.0; 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.35e-65], t$95$1, If[LessEqual[x, 2.7e-86], N[(y / t), $MachinePrecision], If[LessEqual[x, 8e-37], t$95$1, If[LessEqual[x, 1.45e-18], N[(y / t), $MachinePrecision], 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{-65}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{-86}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{-18}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.3499999999999999e-65 or 2.69999999999999992e-86 < x < 8.00000000000000053e-37Initial program 90.3%
*-commutative90.3%
Simplified90.3%
Taylor expanded in t around inf 75.7%
+-commutative75.7%
Simplified75.7%
if -1.3499999999999999e-65 < x < 2.69999999999999992e-86 or 8.00000000000000053e-37 < x < 1.45e-18Initial program 87.7%
*-commutative87.7%
Simplified87.7%
Taylor expanded in z around inf 77.4%
div-inv77.4%
Applied egg-rr77.4%
Taylor expanded in x around 0 61.5%
if 1.45e-18 < x Initial program 91.5%
*-commutative91.5%
Simplified91.5%
Taylor expanded in z around inf 64.8%
div-inv64.7%
Applied egg-rr64.7%
Taylor expanded in x around inf 88.4%
Final simplification73.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (+ x 1.0))))
(if (<= x -7e-65)
t_1
(if (<= x 7.2e-83)
(/ (/ y t) (+ x 1.0))
(if (<= x 5e-36) t_1 (if (<= x 7.5e-19) (/ y t) 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = x / (x + 1.0);
double tmp;
if (x <= -7e-65) {
tmp = t_1;
} else if (x <= 7.2e-83) {
tmp = (y / t) / (x + 1.0);
} else if (x <= 5e-36) {
tmp = t_1;
} else if (x <= 7.5e-19) {
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) :: t_1
real(8) :: tmp
t_1 = x / (x + 1.0d0)
if (x <= (-7d-65)) then
tmp = t_1
else if (x <= 7.2d-83) then
tmp = (y / t) / (x + 1.0d0)
else if (x <= 5d-36) then
tmp = t_1
else if (x <= 7.5d-19) 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 t_1 = x / (x + 1.0);
double tmp;
if (x <= -7e-65) {
tmp = t_1;
} else if (x <= 7.2e-83) {
tmp = (y / t) / (x + 1.0);
} else if (x <= 5e-36) {
tmp = t_1;
} else if (x <= 7.5e-19) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = x / (x + 1.0) tmp = 0 if x <= -7e-65: tmp = t_1 elif x <= 7.2e-83: tmp = (y / t) / (x + 1.0) elif x <= 5e-36: tmp = t_1 elif x <= 7.5e-19: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) t_1 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (x <= -7e-65) tmp = t_1; elseif (x <= 7.2e-83) tmp = Float64(Float64(y / t) / Float64(x + 1.0)); elseif (x <= 5e-36) tmp = t_1; elseif (x <= 7.5e-19) tmp = Float64(y / t); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x / (x + 1.0); tmp = 0.0; if (x <= -7e-65) tmp = t_1; elseif (x <= 7.2e-83) tmp = (y / t) / (x + 1.0); elseif (x <= 5e-36) tmp = t_1; elseif (x <= 7.5e-19) tmp = y / t; else tmp = 1.0; 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, -7e-65], t$95$1, If[LessEqual[x, 7.2e-83], N[(N[(y / t), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5e-36], t$95$1, If[LessEqual[x, 7.5e-19], N[(y / t), $MachinePrecision], 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -7 \cdot 10^{-65}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{-83}:\\
\;\;\;\;\frac{\frac{y}{t}}{x + 1}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-36}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-19}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -7.00000000000000009e-65 or 7.20000000000000025e-83 < x < 5.00000000000000004e-36Initial program 90.3%
*-commutative90.3%
Simplified90.3%
Taylor expanded in t around inf 75.7%
+-commutative75.7%
Simplified75.7%
if -7.00000000000000009e-65 < x < 7.20000000000000025e-83Initial program 88.4%
*-commutative88.4%
Simplified88.4%
Taylor expanded in y around inf 58.9%
associate-/l*60.1%
+-commutative60.1%
Simplified60.1%
Taylor expanded in z around inf 60.9%
associate-/r*60.9%
+-commutative60.9%
Simplified60.9%
associate-*r/60.9%
un-div-inv61.3%
Applied egg-rr61.3%
if 5.00000000000000004e-36 < x < 7.49999999999999957e-19Initial program 66.7%
*-commutative66.7%
Simplified66.7%
Taylor expanded in z around inf 69.8%
div-inv69.8%
Applied egg-rr69.8%
Taylor expanded in x around 0 69.8%
if 7.49999999999999957e-19 < x Initial program 91.5%
*-commutative91.5%
Simplified91.5%
Taylor expanded in z around inf 64.8%
div-inv64.7%
Applied egg-rr64.7%
Taylor expanded in x around inf 88.4%
Final simplification73.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.2e-56) (not (<= t 1.2e-92))) (/ (+ x (/ y t)) (+ x 1.0)) (+ 1.0 (* (/ y (- -1.0 x)) (/ z x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.2e-56) || !(t <= 1.2e-92)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + ((y / (-1.0 - x)) * (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 <= (-5.2d-56)) .or. (.not. (t <= 1.2d-92))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 + ((y / ((-1.0d0) - x)) * (z / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.2e-56) || !(t <= 1.2e-92)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + ((y / (-1.0 - x)) * (z / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.2e-56) or not (t <= 1.2e-92): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 + ((y / (-1.0 - x)) * (z / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5.2e-56) || !(t <= 1.2e-92)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 + Float64(Float64(y / Float64(-1.0 - x)) * Float64(z / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -5.2e-56) || ~((t <= 1.2e-92))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 + ((y / (-1.0 - x)) * (z / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5.2e-56], N[Not[LessEqual[t, 1.2e-92]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(y / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.2 \cdot 10^{-56} \lor \neg \left(t \leq 1.2 \cdot 10^{-92}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y}{-1 - x} \cdot \frac{z}{x}\\
\end{array}
\end{array}
if t < -5.19999999999999994e-56 or 1.2000000000000001e-92 < t Initial program 86.1%
*-commutative86.1%
Simplified86.1%
Taylor expanded in z around inf 90.2%
if -5.19999999999999994e-56 < t < 1.2000000000000001e-92Initial program 95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in t around 0 78.5%
associate-+r+78.5%
mul-1-neg78.5%
unsub-neg78.5%
+-commutative78.5%
associate-/l*82.5%
+-commutative82.5%
Simplified82.5%
div-sub82.5%
pow182.5%
pow182.5%
pow-div82.5%
metadata-eval82.5%
metadata-eval82.5%
Applied egg-rr82.5%
Taylor expanded in y around 0 78.4%
+-commutative78.4%
*-commutative78.4%
times-frac82.5%
Simplified82.5%
Final simplification87.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.15e-61) (not (<= z 3.2e-165))) (/ (+ x (/ y t)) (+ x 1.0)) (- 1.0 (* y (/ z x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15e-61) || !(z <= 3.2e-165)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - (y * (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 ((z <= (-1.15d-61)) .or. (.not. (z <= 3.2d-165))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 - (y * (z / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15e-61) || !(z <= 3.2e-165)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - (y * (z / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.15e-61) or not (z <= 3.2e-165): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 - (y * (z / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.15e-61) || !(z <= 3.2e-165)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 - Float64(y * Float64(z / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.15e-61) || ~((z <= 3.2e-165))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 - (y * (z / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.15e-61], N[Not[LessEqual[z, 3.2e-165]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{-61} \lor \neg \left(z \leq 3.2 \cdot 10^{-165}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot \frac{z}{x}\\
\end{array}
\end{array}
if z < -1.14999999999999996e-61 or 3.20000000000000013e-165 < z Initial program 85.7%
*-commutative85.7%
Simplified85.7%
Taylor expanded in z around inf 84.4%
if -1.14999999999999996e-61 < z < 3.20000000000000013e-165Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 81.9%
associate-+r+81.9%
mul-1-neg81.9%
unsub-neg81.9%
+-commutative81.9%
associate-/l*81.9%
+-commutative81.9%
Simplified81.9%
div-sub81.9%
pow181.9%
pow181.9%
pow-div81.9%
metadata-eval81.9%
metadata-eval81.9%
Applied egg-rr81.9%
Taylor expanded in x around 0 79.6%
associate-*r/79.6%
Simplified79.6%
Final simplification83.1%
(FPCore (x y z t) :precision binary64 (if (<= x -2.6e-29) 1.0 (if (<= x 2.3e-18) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.6e-29) {
tmp = 1.0;
} else if (x <= 2.3e-18) {
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 <= (-2.6d-29)) then
tmp = 1.0d0
else if (x <= 2.3d-18) 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 <= -2.6e-29) {
tmp = 1.0;
} else if (x <= 2.3e-18) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.6e-29: tmp = 1.0 elif x <= 2.3e-18: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.6e-29) tmp = 1.0; elseif (x <= 2.3e-18) 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 <= -2.6e-29) tmp = 1.0; elseif (x <= 2.3e-18) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.6e-29], 1.0, If[LessEqual[x, 2.3e-18], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{-29}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-18}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.6000000000000002e-29 or 2.3000000000000001e-18 < x Initial program 90.1%
*-commutative90.1%
Simplified90.1%
Taylor expanded in z around inf 71.5%
div-inv71.4%
Applied egg-rr71.4%
Taylor expanded in x around inf 86.1%
if -2.6000000000000002e-29 < x < 2.3000000000000001e-18Initial program 89.0%
*-commutative89.0%
Simplified89.0%
Taylor expanded in z around inf 76.2%
div-inv76.2%
Applied egg-rr76.2%
Taylor expanded in x around 0 54.6%
Final simplification71.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 89.6%
*-commutative89.6%
Simplified89.6%
Taylor expanded in z around inf 73.7%
div-inv73.6%
Applied egg-rr73.6%
Taylor expanded in x around inf 52.6%
Final simplification52.6%
(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 2024041
(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)))