
(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
def code(x, y, z, t): return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
def code(x, y, z, t): return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\end{array}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- (/ (- (* y z) x) (- x (* z t))) x) (- -1.0 x)))
(t_2 (/ y (+ x 1.0))))
(if (<= t_1 -5e+22)
(* (/ z (- (* z t) x)) t_2)
(if (<= t_1 5e+268)
t_1
(+ (/ (- t_2 (/ x (* z (+ x 1.0)))) t) (/ x (+ x 1.0)))))))
double code(double x, double y, double z, double t) {
double t_1 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x);
double t_2 = y / (x + 1.0);
double tmp;
if (t_1 <= -5e+22) {
tmp = (z / ((z * t) - x)) * t_2;
} else if (t_1 <= 5e+268) {
tmp = t_1;
} else {
tmp = ((t_2 - (x / (z * (x + 1.0)))) / t) + (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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = ((((y * z) - x) / (x - (z * t))) - x) / ((-1.0d0) - x)
t_2 = y / (x + 1.0d0)
if (t_1 <= (-5d+22)) then
tmp = (z / ((z * t) - x)) * t_2
else if (t_1 <= 5d+268) then
tmp = t_1
else
tmp = ((t_2 - (x / (z * (x + 1.0d0)))) / t) + (x / (x + 1.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x);
double t_2 = y / (x + 1.0);
double tmp;
if (t_1 <= -5e+22) {
tmp = (z / ((z * t) - x)) * t_2;
} else if (t_1 <= 5e+268) {
tmp = t_1;
} else {
tmp = ((t_2 - (x / (z * (x + 1.0)))) / t) + (x / (x + 1.0));
}
return tmp;
}
def code(x, y, z, t): t_1 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x) t_2 = y / (x + 1.0) tmp = 0 if t_1 <= -5e+22: tmp = (z / ((z * t) - x)) * t_2 elif t_1 <= 5e+268: tmp = t_1 else: tmp = ((t_2 - (x / (z * (x + 1.0)))) / t) + (x / (x + 1.0)) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(Float64(Float64(y * z) - x) / Float64(x - Float64(z * t))) - x) / Float64(-1.0 - x)) t_2 = Float64(y / Float64(x + 1.0)) tmp = 0.0 if (t_1 <= -5e+22) tmp = Float64(Float64(z / Float64(Float64(z * t) - x)) * t_2); elseif (t_1 <= 5e+268) tmp = t_1; else tmp = Float64(Float64(Float64(t_2 - Float64(x / Float64(z * Float64(x + 1.0)))) / t) + Float64(x / Float64(x + 1.0))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x); t_2 = y / (x + 1.0); tmp = 0.0; if (t_1 <= -5e+22) tmp = (z / ((z * t) - x)) * t_2; elseif (t_1 <= 5e+268) tmp = t_1; else tmp = ((t_2 - (x / (z * (x + 1.0)))) / t) + (x / (x + 1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+22], N[(N[(z / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$1, 5e+268], t$95$1, N[(N[(N[(t$95$2 - N[(x / N[(z * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] + N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{y \cdot z - x}{x - z \cdot t} - x}{-1 - x}\\
t_2 := \frac{y}{x + 1}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+22}:\\
\;\;\;\;\frac{z}{z \cdot t - x} \cdot t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+268}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_2 - \frac{x}{z \cdot \left(x + 1\right)}}{t} + \frac{x}{x + 1}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < -4.9999999999999996e22Initial program 68.3%
*-commutative68.3%
Simplified68.3%
Taylor expanded in y around inf 68.1%
times-frac88.3%
+-commutative88.3%
*-commutative88.3%
Applied egg-rr88.3%
if -4.9999999999999996e22 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 5.0000000000000002e268Initial program 98.5%
if 5.0000000000000002e268 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 25.5%
*-commutative25.5%
Simplified25.5%
Taylor expanded in t around -inf 86.4%
Final simplification95.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- (/ (- (* y z) x) (- x (* z t))) x) (- -1.0 x))))
(if (<= t_1 -5e+22)
(* (/ z (- (* z t) x)) (/ y (+ x 1.0)))
(if (<= t_1 5e+268) t_1 (/ (+ x (/ (- y (/ x z)) t)) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x);
double tmp;
if (t_1 <= -5e+22) {
tmp = (z / ((z * t) - x)) * (y / (x + 1.0));
} else if (t_1 <= 5e+268) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = ((((y * z) - x) / (x - (z * t))) - x) / ((-1.0d0) - x)
if (t_1 <= (-5d+22)) then
tmp = (z / ((z * t) - x)) * (y / (x + 1.0d0))
else if (t_1 <= 5d+268) then
tmp = t_1
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 t_1 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x);
double tmp;
if (t_1 <= -5e+22) {
tmp = (z / ((z * t) - x)) * (y / (x + 1.0));
} else if (t_1 <= 5e+268) {
tmp = t_1;
} else {
tmp = (x + ((y - (x / z)) / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x) tmp = 0 if t_1 <= -5e+22: tmp = (z / ((z * t) - x)) * (y / (x + 1.0)) elif t_1 <= 5e+268: tmp = t_1 else: tmp = (x + ((y - (x / z)) / t)) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(Float64(Float64(y * z) - x) / Float64(x - Float64(z * t))) - x) / Float64(-1.0 - x)) tmp = 0.0 if (t_1 <= -5e+22) tmp = Float64(Float64(z / Float64(Float64(z * t) - x)) * Float64(y / Float64(x + 1.0))); elseif (t_1 <= 5e+268) tmp = t_1; 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) t_1 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x); tmp = 0.0; if (t_1 <= -5e+22) tmp = (z / ((z * t) - x)) * (y / (x + 1.0)); elseif (t_1 <= 5e+268) tmp = t_1; else tmp = (x + ((y - (x / z)) / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+22], N[(N[(z / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] * N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+268], t$95$1, 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}
t_1 := \frac{\frac{y \cdot z - x}{x - z \cdot t} - x}{-1 - x}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+22}:\\
\;\;\;\;\frac{z}{z \cdot t - x} \cdot \frac{y}{x + 1}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+268}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y - \frac{x}{z}}{t}}{x + 1}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < -4.9999999999999996e22Initial program 68.3%
*-commutative68.3%
Simplified68.3%
Taylor expanded in y around inf 68.1%
times-frac88.3%
+-commutative88.3%
*-commutative88.3%
Applied egg-rr88.3%
if -4.9999999999999996e22 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 5.0000000000000002e268Initial program 98.5%
if 5.0000000000000002e268 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 25.5%
*-commutative25.5%
Simplified25.5%
Taylor expanded in t around -inf 81.7%
mul-1-neg81.7%
unsub-neg81.7%
cancel-sign-sub-inv81.7%
metadata-eval81.7%
*-lft-identity81.7%
+-commutative81.7%
mul-1-neg81.7%
unsub-neg81.7%
Simplified81.7%
Final simplification95.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ x (/ y t)) (+ x 1.0))))
(if (<= z -1.05e-14)
t_1
(if (<= z -5.6e-219)
(/ (+ 1.0 (- x (* y (/ z x)))) (+ x 1.0))
(if (<= z 2.2e-98) (/ (+ x (/ x (- x (* z t)))) (+ x 1.0)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x + (y / t)) / (x + 1.0);
double tmp;
if (z <= -1.05e-14) {
tmp = t_1;
} else if (z <= -5.6e-219) {
tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0);
} else if (z <= 2.2e-98) {
tmp = (x + (x / (x - (z * 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 + (y / t)) / (x + 1.0d0)
if (z <= (-1.05d-14)) then
tmp = t_1
else if (z <= (-5.6d-219)) then
tmp = (1.0d0 + (x - (y * (z / x)))) / (x + 1.0d0)
else if (z <= 2.2d-98) then
tmp = (x + (x / (x - (z * 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 + (y / t)) / (x + 1.0);
double tmp;
if (z <= -1.05e-14) {
tmp = t_1;
} else if (z <= -5.6e-219) {
tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0);
} else if (z <= 2.2e-98) {
tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (y / t)) / (x + 1.0) tmp = 0 if z <= -1.05e-14: tmp = t_1 elif z <= -5.6e-219: tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0) elif z <= 2.2e-98: tmp = (x + (x / (x - (z * t)))) / (x + 1.0) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)) tmp = 0.0 if (z <= -1.05e-14) tmp = t_1; elseif (z <= -5.6e-219) tmp = Float64(Float64(1.0 + Float64(x - Float64(y * Float64(z / x)))) / Float64(x + 1.0)); elseif (z <= 2.2e-98) tmp = Float64(Float64(x + Float64(x / Float64(x - Float64(z * t)))) / Float64(x + 1.0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + (y / t)) / (x + 1.0); tmp = 0.0; if (z <= -1.05e-14) tmp = t_1; elseif (z <= -5.6e-219) tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0); elseif (z <= 2.2e-98) tmp = (x + (x / (x - (z * t)))) / (x + 1.0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.05e-14], t$95$1, If[LessEqual[z, -5.6e-219], N[(N[(1.0 + N[(x - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2e-98], N[(N[(x + N[(x / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{if}\;z \leq -1.05 \cdot 10^{-14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -5.6 \cdot 10^{-219}:\\
\;\;\;\;\frac{1 + \left(x - y \cdot \frac{z}{x}\right)}{x + 1}\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-98}:\\
\;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.0499999999999999e-14 or 2.19999999999999996e-98 < z Initial program 79.1%
*-commutative79.1%
Simplified79.1%
Taylor expanded in z around inf 81.3%
+-commutative81.3%
+-commutative81.3%
Simplified81.3%
if -1.0499999999999999e-14 < z < -5.5999999999999998e-219Initial program 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in t around 0 78.1%
mul-1-neg78.1%
unsub-neg78.1%
associate-/l*78.3%
+-commutative78.3%
Simplified78.3%
if -5.5999999999999998e-219 < z < 2.19999999999999996e-98Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 89.4%
+-commutative89.4%
Simplified89.4%
Final simplification82.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.2e-34) (not (<= t 5.4e-73))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ 1.0 (- x (* y (/ z x)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.2e-34) || !(t <= 5.4e-73)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (1.0 + (x - (y * (z / 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 ((t <= (-2.2d-34)) .or. (.not. (t <= 5.4d-73))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (1.0d0 + (x - (y * (z / 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 ((t <= -2.2e-34) || !(t <= 5.4e-73)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.2e-34) or not (t <= 5.4e-73): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.2e-34) || !(t <= 5.4e-73)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(1.0 + Float64(x - Float64(y * Float64(z / x)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.2e-34) || ~((t <= 5.4e-73))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.2e-34], N[Not[LessEqual[t, 5.4e-73]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.2 \cdot 10^{-34} \lor \neg \left(t \leq 5.4 \cdot 10^{-73}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - y \cdot \frac{z}{x}\right)}{x + 1}\\
\end{array}
\end{array}
if t < -2.1999999999999999e-34 or 5.39999999999999989e-73 < t Initial program 85.2%
*-commutative85.2%
Simplified85.2%
Taylor expanded in z around inf 86.7%
+-commutative86.7%
+-commutative86.7%
Simplified86.7%
if -2.1999999999999999e-34 < t < 5.39999999999999989e-73Initial program 90.0%
*-commutative90.0%
Simplified90.0%
Taylor expanded in t around 0 69.2%
mul-1-neg69.2%
unsub-neg69.2%
associate-/l*74.7%
+-commutative74.7%
Simplified74.7%
Final simplification81.2%
(FPCore (x y z t)
:precision binary64
(if (<= x -0.017)
(/ (+ 1.0 (- x (* y (/ z x)))) (+ x 1.0))
(if (<= x 3.95e-53)
(/ (+ x (/ (- y (/ x z)) t)) (+ x 1.0))
(/ (+ x (/ x (- x (* z t)))) (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.017) {
tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0);
} else if (x <= 3.95e-53) {
tmp = (x + ((y - (x / z)) / t)) / (x + 1.0);
} else {
tmp = (x + (x / (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 <= (-0.017d0)) then
tmp = (1.0d0 + (x - (y * (z / x)))) / (x + 1.0d0)
else if (x <= 3.95d-53) then
tmp = (x + ((y - (x / z)) / t)) / (x + 1.0d0)
else
tmp = (x + (x / (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 <= -0.017) {
tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0);
} else if (x <= 3.95e-53) {
tmp = (x + ((y - (x / z)) / t)) / (x + 1.0);
} else {
tmp = (x + (x / (x - (z * t)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -0.017: tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0) elif x <= 3.95e-53: tmp = (x + ((y - (x / z)) / t)) / (x + 1.0) else: tmp = (x + (x / (x - (z * t)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -0.017) tmp = Float64(Float64(1.0 + Float64(x - Float64(y * Float64(z / x)))) / Float64(x + 1.0)); elseif (x <= 3.95e-53) tmp = Float64(Float64(x + Float64(Float64(y - Float64(x / z)) / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(x / Float64(x - Float64(z * t)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -0.017) tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0); elseif (x <= 3.95e-53) tmp = (x + ((y - (x / z)) / t)) / (x + 1.0); else tmp = (x + (x / (x - (z * t)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -0.017], N[(N[(1.0 + N[(x - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.95e-53], N[(N[(x + N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(x / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.017:\\
\;\;\;\;\frac{1 + \left(x - y \cdot \frac{z}{x}\right)}{x + 1}\\
\mathbf{elif}\;x \leq 3.95 \cdot 10^{-53}:\\
\;\;\;\;\frac{x + \frac{y - \frac{x}{z}}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{x}{x - z \cdot t}}{x + 1}\\
\end{array}
\end{array}
if x < -0.017000000000000001Initial program 86.3%
*-commutative86.3%
Simplified86.3%
Taylor expanded in t around 0 80.7%
mul-1-neg80.7%
unsub-neg80.7%
associate-/l*87.0%
+-commutative87.0%
Simplified87.0%
if -0.017000000000000001 < x < 3.9499999999999999e-53Initial program 88.7%
*-commutative88.7%
Simplified88.7%
Taylor expanded in t around -inf 75.7%
mul-1-neg75.7%
unsub-neg75.7%
cancel-sign-sub-inv75.7%
metadata-eval75.7%
*-lft-identity75.7%
+-commutative75.7%
mul-1-neg75.7%
unsub-neg75.7%
Simplified75.7%
if 3.9499999999999999e-53 < x Initial program 86.2%
*-commutative86.2%
Simplified86.2%
Taylor expanded in y around 0 86.8%
+-commutative86.8%
Simplified86.8%
Final simplification81.7%
(FPCore (x y z t) :precision binary64 (if (<= x -1.45e+47) 1.0 (if (<= x 5.2e-38) (/ (+ x (/ y t)) (+ x 1.0)) (/ x (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.45e+47) {
tmp = 1.0;
} else if (x <= 5.2e-38) {
tmp = (x + (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.45d+47)) then
tmp = 1.0d0
else if (x <= 5.2d-38) then
tmp = (x + (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.45e+47) {
tmp = 1.0;
} else if (x <= 5.2e-38) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = x / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.45e+47: tmp = 1.0 elif x <= 5.2e-38: tmp = (x + (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.45e+47) tmp = 1.0; elseif (x <= 5.2e-38) tmp = Float64(Float64(x + Float64(y / 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.45e+47) tmp = 1.0; elseif (x <= 5.2e-38) tmp = (x + (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.45e+47], 1.0, If[LessEqual[x, 5.2e-38], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{+47}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-38}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1}\\
\end{array}
\end{array}
if x < -1.4499999999999999e47Initial program 83.8%
*-commutative83.8%
Simplified83.8%
Taylor expanded in x around inf 90.4%
if -1.4499999999999999e47 < x < 5.20000000000000022e-38Initial program 89.2%
*-commutative89.2%
Simplified89.2%
Taylor expanded in z around inf 67.8%
+-commutative67.8%
+-commutative67.8%
Simplified67.8%
if 5.20000000000000022e-38 < x Initial program 87.1%
*-commutative87.1%
Simplified87.1%
Taylor expanded in t around inf 87.7%
+-commutative87.7%
Simplified87.7%
Final simplification77.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -9.5e-45) (not (<= x 5.9e-39))) (/ x (+ x 1.0)) (/ y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -9.5e-45) || !(x <= 5.9e-39)) {
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 <= (-9.5d-45)) .or. (.not. (x <= 5.9d-39))) 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 <= -9.5e-45) || !(x <= 5.9e-39)) {
tmp = x / (x + 1.0);
} else {
tmp = y / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -9.5e-45) or not (x <= 5.9e-39): tmp = x / (x + 1.0) else: tmp = y / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -9.5e-45) || !(x <= 5.9e-39)) 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 <= -9.5e-45) || ~((x <= 5.9e-39))) tmp = x / (x + 1.0); else tmp = y / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -9.5e-45], N[Not[LessEqual[x, 5.9e-39]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-45} \lor \neg \left(x \leq 5.9 \cdot 10^{-39}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t}\\
\end{array}
\end{array}
if x < -9.5000000000000002e-45 or 5.8999999999999998e-39 < x Initial program 86.8%
*-commutative86.8%
Simplified86.8%
Taylor expanded in t around inf 84.4%
+-commutative84.4%
Simplified84.4%
if -9.5000000000000002e-45 < x < 5.8999999999999998e-39Initial program 88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in x around 0 53.4%
Final simplification70.6%
(FPCore (x y z t) :precision binary64 (if (<= x -11200.0) 1.0 (if (<= x 4.9e-54) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -11200.0) {
tmp = 1.0;
} else if (x <= 4.9e-54) {
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 <= (-11200.0d0)) then
tmp = 1.0d0
else if (x <= 4.9d-54) 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 <= -11200.0) {
tmp = 1.0;
} else if (x <= 4.9e-54) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -11200.0: tmp = 1.0 elif x <= 4.9e-54: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -11200.0) tmp = 1.0; elseif (x <= 4.9e-54) 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 <= -11200.0) tmp = 1.0; elseif (x <= 4.9e-54) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -11200.0], 1.0, If[LessEqual[x, 4.9e-54], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -11200:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 4.9 \cdot 10^{-54}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -11200 or 4.90000000000000021e-54 < x Initial program 86.1%
*-commutative86.1%
Simplified86.1%
Taylor expanded in x around inf 84.2%
if -11200 < x < 4.90000000000000021e-54Initial program 88.9%
*-commutative88.9%
Simplified88.9%
Taylor expanded in x around 0 50.7%
(FPCore (x y z t) :precision binary64 1.0)
double code(double x, double y, double z, double t) {
return 1.0;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0
end function
public static double code(double x, double y, double z, double t) {
return 1.0;
}
def code(x, y, z, t): return 1.0
function code(x, y, z, t) return 1.0 end
function tmp = code(x, y, z, t) tmp = 1.0; end
code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 87.4%
*-commutative87.4%
Simplified87.4%
Taylor expanded in x around inf 51.1%
(FPCore (x y z t) :precision binary64 (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0);
}
def code(x, y, z, t): return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(y / Float64(t - Float64(x / z))) - Float64(x / Float64(Float64(t * z) - x)))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \left(\frac{y}{t - \frac{x}{z}} - \frac{x}{t \cdot z - x}\right)}{x + 1}
\end{array}
herbie shell --seed 2024132
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:alt
(! :herbie-platform default (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1)))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))