
(FPCore (x y z t) :precision binary64 (- x (/ (* (* y 2.0) z) (- (* (* z 2.0) z) (* y t)))))
double code(double x, double y, double z, double t) {
return x - (((y * 2.0) * z) / (((z * 2.0) * z) - (y * t)));
}
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 * 2.0d0) * z) / (((z * 2.0d0) * z) - (y * t)))
end function
public static double code(double x, double y, double z, double t) {
return x - (((y * 2.0) * z) / (((z * 2.0) * z) - (y * t)));
}
def code(x, y, z, t): return x - (((y * 2.0) * z) / (((z * 2.0) * z) - (y * t)))
function code(x, y, z, t) return Float64(x - Float64(Float64(Float64(y * 2.0) * z) / Float64(Float64(Float64(z * 2.0) * z) - Float64(y * t)))) end
function tmp = code(x, y, z, t) tmp = x - (((y * 2.0) * z) / (((z * 2.0) * z) - (y * t))); end
code[x_, y_, z_, t_] := N[(x - N[(N[(N[(y * 2.0), $MachinePrecision] * z), $MachinePrecision] / N[(N[(N[(z * 2.0), $MachinePrecision] * z), $MachinePrecision] - N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{\left(y \cdot 2\right) \cdot z}{\left(z \cdot 2\right) \cdot z - y \cdot t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- x (/ (* (* y 2.0) z) (- (* (* z 2.0) z) (* y t)))))
double code(double x, double y, double z, double t) {
return x - (((y * 2.0) * z) / (((z * 2.0) * z) - (y * t)));
}
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 * 2.0d0) * z) / (((z * 2.0d0) * z) - (y * t)))
end function
public static double code(double x, double y, double z, double t) {
return x - (((y * 2.0) * z) / (((z * 2.0) * z) - (y * t)));
}
def code(x, y, z, t): return x - (((y * 2.0) * z) / (((z * 2.0) * z) - (y * t)))
function code(x, y, z, t) return Float64(x - Float64(Float64(Float64(y * 2.0) * z) / Float64(Float64(Float64(z * 2.0) * z) - Float64(y * t)))) end
function tmp = code(x, y, z, t) tmp = x - (((y * 2.0) * z) / (((z * 2.0) * z) - (y * t))); end
code[x_, y_, z_, t_] := N[(x - N[(N[(N[(y * 2.0), $MachinePrecision] * z), $MachinePrecision] / N[(N[(N[(z * 2.0), $MachinePrecision] * z), $MachinePrecision] - N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{\left(y \cdot 2\right) \cdot z}{\left(z \cdot 2\right) \cdot z - y \cdot t}
\end{array}
(FPCore (x y z t)
:precision binary64
(if (<= z -6.1e+116)
(fma y (* 2.0 (/ -0.5 z)) x)
(if (<= z 1.8e+68)
(+ x (/ (* (/ 2.0 y) (* y z)) (- t (/ (* z (* 2.0 z)) y))))
(- x (/ y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.1e+116) {
tmp = fma(y, (2.0 * (-0.5 / z)), x);
} else if (z <= 1.8e+68) {
tmp = x + (((2.0 / y) * (y * z)) / (t - ((z * (2.0 * z)) / y)));
} else {
tmp = x - (y / z);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -6.1e+116) tmp = fma(y, Float64(2.0 * Float64(-0.5 / z)), x); elseif (z <= 1.8e+68) tmp = Float64(x + Float64(Float64(Float64(2.0 / y) * Float64(y * z)) / Float64(t - Float64(Float64(z * Float64(2.0 * z)) / y)))); else tmp = Float64(x - Float64(y / z)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -6.1e+116], N[(y * N[(2.0 * N[(-0.5 / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.8e+68], N[(x + N[(N[(N[(2.0 / y), $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(N[(z * N[(2.0 * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.1 \cdot 10^{+116}:\\
\;\;\;\;\mathsf{fma}\left(y, 2 \cdot \frac{-0.5}{z}, x\right)\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+68}:\\
\;\;\;\;x + \frac{\frac{2}{y} \cdot \left(y \cdot z\right)}{t - \frac{z \cdot \left(2 \cdot z\right)}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{z}\\
\end{array}
\end{array}
if z < -6.10000000000000018e116Initial program 77.0%
sub-neg77.0%
+-commutative77.0%
associate-/l*90.4%
associate-*l*90.4%
distribute-rgt-neg-in90.4%
fma-define90.4%
Simplified90.4%
Taylor expanded in z around inf 94.5%
if -6.10000000000000018e116 < z < 1.7999999999999999e68Initial program 93.0%
Taylor expanded in y around inf 92.9%
associate-*r/92.9%
Simplified92.9%
unpow292.9%
associate-*r*92.9%
Applied egg-rr92.9%
*-commutative92.9%
associate-*r*92.9%
times-frac92.8%
*-commutative92.8%
associate-*l*92.8%
*-un-lft-identity92.8%
times-frac92.8%
metadata-eval92.8%
pow292.8%
Applied egg-rr92.8%
associate-*r/96.2%
associate-*r/96.2%
Simplified96.2%
unpow292.9%
associate-*r*92.9%
Applied egg-rr96.2%
if 1.7999999999999999e68 < z Initial program 67.5%
Taylor expanded in y around 0 96.7%
Final simplification96.1%
(FPCore (x y z t) :precision binary64 (if (<= (/ (* (* y 2.0) z) (- (* z (* 2.0 z)) (* y t))) 2e+170) (fma y (* 2.0 (/ z (fma -2.0 (* z z) (* y t)))) x) (- x (/ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((((y * 2.0) * z) / ((z * (2.0 * z)) - (y * t))) <= 2e+170) {
tmp = fma(y, (2.0 * (z / fma(-2.0, (z * z), (y * t)))), x);
} else {
tmp = x - (y / z);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(Float64(Float64(y * 2.0) * z) / Float64(Float64(z * Float64(2.0 * z)) - Float64(y * t))) <= 2e+170) tmp = fma(y, Float64(2.0 * Float64(z / fma(-2.0, Float64(z * z), Float64(y * t)))), x); else tmp = Float64(x - Float64(y / z)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(N[(y * 2.0), $MachinePrecision] * z), $MachinePrecision] / N[(N[(z * N[(2.0 * z), $MachinePrecision]), $MachinePrecision] - N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+170], N[(y * N[(2.0 * N[(z / N[(-2.0 * N[(z * z), $MachinePrecision] + N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x - N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\left(y \cdot 2\right) \cdot z}{z \cdot \left(2 \cdot z\right) - y \cdot t} \leq 2 \cdot 10^{+170}:\\
\;\;\;\;\mathsf{fma}\left(y, 2 \cdot \frac{z}{\mathsf{fma}\left(-2, z \cdot z, y \cdot t\right)}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{z}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (*.f64 y #s(literal 2 binary64)) z) (-.f64 (*.f64 (*.f64 z #s(literal 2 binary64)) z) (*.f64 y t))) < 2.00000000000000007e170Initial program 95.7%
sub-neg95.7%
+-commutative95.7%
associate-/l*97.0%
associate-*l*97.0%
distribute-rgt-neg-in97.0%
fma-define97.0%
Simplified97.0%
if 2.00000000000000007e170 < (/.f64 (*.f64 (*.f64 y #s(literal 2 binary64)) z) (-.f64 (*.f64 (*.f64 z #s(literal 2 binary64)) z) (*.f64 y t))) Initial program 0.6%
Taylor expanded in y around 0 82.9%
Final simplification95.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (* y 2.0) z)) (t_2 (* z (* 2.0 z))))
(if (<= (/ t_1 (- t_2 (* y t))) 2e+170)
(+ x (/ t_1 (- (* y t) t_2)))
(- x (/ y z)))))
double code(double x, double y, double z, double t) {
double t_1 = (y * 2.0) * z;
double t_2 = z * (2.0 * z);
double tmp;
if ((t_1 / (t_2 - (y * t))) <= 2e+170) {
tmp = x + (t_1 / ((y * t) - t_2));
} else {
tmp = x - (y / z);
}
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 * 2.0d0) * z
t_2 = z * (2.0d0 * z)
if ((t_1 / (t_2 - (y * t))) <= 2d+170) then
tmp = x + (t_1 / ((y * t) - t_2))
else
tmp = x - (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y * 2.0) * z;
double t_2 = z * (2.0 * z);
double tmp;
if ((t_1 / (t_2 - (y * t))) <= 2e+170) {
tmp = x + (t_1 / ((y * t) - t_2));
} else {
tmp = x - (y / z);
}
return tmp;
}
def code(x, y, z, t): t_1 = (y * 2.0) * z t_2 = z * (2.0 * z) tmp = 0 if (t_1 / (t_2 - (y * t))) <= 2e+170: tmp = x + (t_1 / ((y * t) - t_2)) else: tmp = x - (y / z) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y * 2.0) * z) t_2 = Float64(z * Float64(2.0 * z)) tmp = 0.0 if (Float64(t_1 / Float64(t_2 - Float64(y * t))) <= 2e+170) tmp = Float64(x + Float64(t_1 / Float64(Float64(y * t) - t_2))); else tmp = Float64(x - Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y * 2.0) * z; t_2 = z * (2.0 * z); tmp = 0.0; if ((t_1 / (t_2 - (y * t))) <= 2e+170) tmp = x + (t_1 / ((y * t) - t_2)); else tmp = x - (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y * 2.0), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(2.0 * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 / N[(t$95$2 - N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+170], N[(x + N[(t$95$1 / N[(N[(y * t), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y \cdot 2\right) \cdot z\\
t_2 := z \cdot \left(2 \cdot z\right)\\
\mathbf{if}\;\frac{t\_1}{t\_2 - y \cdot t} \leq 2 \cdot 10^{+170}:\\
\;\;\;\;x + \frac{t\_1}{y \cdot t - t\_2}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{z}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (*.f64 y #s(literal 2 binary64)) z) (-.f64 (*.f64 (*.f64 z #s(literal 2 binary64)) z) (*.f64 y t))) < 2.00000000000000007e170Initial program 95.7%
if 2.00000000000000007e170 < (/.f64 (*.f64 (*.f64 y #s(literal 2 binary64)) z) (-.f64 (*.f64 (*.f64 z #s(literal 2 binary64)) z) (*.f64 y t))) Initial program 0.6%
Taylor expanded in y around 0 82.9%
Final simplification94.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.5e+115) (not (<= z 2.9e+69))) (- x (/ y z)) (+ x (/ (* (/ 2.0 y) (* y z)) (- t (/ (* z (* 2.0 z)) y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.5e+115) || !(z <= 2.9e+69)) {
tmp = x - (y / z);
} else {
tmp = x + (((2.0 / y) * (y * z)) / (t - ((z * (2.0 * z)) / y)));
}
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 <= (-2.5d+115)) .or. (.not. (z <= 2.9d+69))) then
tmp = x - (y / z)
else
tmp = x + (((2.0d0 / y) * (y * z)) / (t - ((z * (2.0d0 * z)) / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.5e+115) || !(z <= 2.9e+69)) {
tmp = x - (y / z);
} else {
tmp = x + (((2.0 / y) * (y * z)) / (t - ((z * (2.0 * z)) / y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.5e+115) or not (z <= 2.9e+69): tmp = x - (y / z) else: tmp = x + (((2.0 / y) * (y * z)) / (t - ((z * (2.0 * z)) / y))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.5e+115) || !(z <= 2.9e+69)) tmp = Float64(x - Float64(y / z)); else tmp = Float64(x + Float64(Float64(Float64(2.0 / y) * Float64(y * z)) / Float64(t - Float64(Float64(z * Float64(2.0 * z)) / y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.5e+115) || ~((z <= 2.9e+69))) tmp = x - (y / z); else tmp = x + (((2.0 / y) * (y * z)) / (t - ((z * (2.0 * z)) / y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.5e+115], N[Not[LessEqual[z, 2.9e+69]], $MachinePrecision]], N[(x - N[(y / z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(2.0 / y), $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(N[(z * N[(2.0 * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+115} \lor \neg \left(z \leq 2.9 \cdot 10^{+69}\right):\\
\;\;\;\;x - \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{2}{y} \cdot \left(y \cdot z\right)}{t - \frac{z \cdot \left(2 \cdot z\right)}{y}}\\
\end{array}
\end{array}
if z < -2.50000000000000004e115 or 2.8999999999999998e69 < z Initial program 70.7%
Taylor expanded in y around 0 95.9%
if -2.50000000000000004e115 < z < 2.8999999999999998e69Initial program 93.0%
Taylor expanded in y around inf 92.9%
associate-*r/92.9%
Simplified92.9%
unpow292.9%
associate-*r*92.9%
Applied egg-rr92.9%
*-commutative92.9%
associate-*r*92.9%
times-frac92.8%
*-commutative92.8%
associate-*l*92.8%
*-un-lft-identity92.8%
times-frac92.8%
metadata-eval92.8%
pow292.8%
Applied egg-rr92.8%
associate-*r/96.2%
associate-*r/96.2%
Simplified96.2%
unpow292.9%
associate-*r*92.9%
Applied egg-rr96.2%
Final simplification96.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- x (/ y z))) (t_2 (- x (* -2.0 (/ z t)))))
(if (<= z -8.5e+17)
t_1
(if (<= z 1.4e-73)
t_2
(if (<= z 2.4e+28) x (if (<= z 1.05e+60) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x - (y / z);
double t_2 = x - (-2.0 * (z / t));
double tmp;
if (z <= -8.5e+17) {
tmp = t_1;
} else if (z <= 1.4e-73) {
tmp = t_2;
} else if (z <= 2.4e+28) {
tmp = x;
} else if (z <= 1.05e+60) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = x - (y / z)
t_2 = x - ((-2.0d0) * (z / t))
if (z <= (-8.5d+17)) then
tmp = t_1
else if (z <= 1.4d-73) then
tmp = t_2
else if (z <= 2.4d+28) then
tmp = x
else if (z <= 1.05d+60) then
tmp = t_2
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 / z);
double t_2 = x - (-2.0 * (z / t));
double tmp;
if (z <= -8.5e+17) {
tmp = t_1;
} else if (z <= 1.4e-73) {
tmp = t_2;
} else if (z <= 2.4e+28) {
tmp = x;
} else if (z <= 1.05e+60) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (y / z) t_2 = x - (-2.0 * (z / t)) tmp = 0 if z <= -8.5e+17: tmp = t_1 elif z <= 1.4e-73: tmp = t_2 elif z <= 2.4e+28: tmp = x elif z <= 1.05e+60: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(y / z)) t_2 = Float64(x - Float64(-2.0 * Float64(z / t))) tmp = 0.0 if (z <= -8.5e+17) tmp = t_1; elseif (z <= 1.4e-73) tmp = t_2; elseif (z <= 2.4e+28) tmp = x; elseif (z <= 1.05e+60) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (y / z); t_2 = x - (-2.0 * (z / t)); tmp = 0.0; if (z <= -8.5e+17) tmp = t_1; elseif (z <= 1.4e-73) tmp = t_2; elseif (z <= 2.4e+28) tmp = x; elseif (z <= 1.05e+60) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(y / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(-2.0 * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.5e+17], t$95$1, If[LessEqual[z, 1.4e-73], t$95$2, If[LessEqual[z, 2.4e+28], x, If[LessEqual[z, 1.05e+60], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y}{z}\\
t_2 := x - -2 \cdot \frac{z}{t}\\
\mathbf{if}\;z \leq -8.5 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-73}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{+28}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{+60}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.5e17 or 1.0500000000000001e60 < z Initial program 74.1%
Taylor expanded in y around 0 93.1%
if -8.5e17 < z < 1.40000000000000006e-73 or 2.39999999999999981e28 < z < 1.0500000000000001e60Initial program 92.9%
Taylor expanded in y around inf 93.4%
if 1.40000000000000006e-73 < z < 2.39999999999999981e28Initial program 96.0%
Taylor expanded in x around inf 87.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.25e+23) (not (<= z 1.35e+60))) (- x (/ y z)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.25e+23) || !(z <= 1.35e+60)) {
tmp = x - (y / z);
} else {
tmp = 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.25d+23)) .or. (.not. (z <= 1.35d+60))) then
tmp = x - (y / z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.25e+23) || !(z <= 1.35e+60)) {
tmp = x - (y / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.25e+23) or not (z <= 1.35e+60): tmp = x - (y / z) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.25e+23) || !(z <= 1.35e+60)) tmp = Float64(x - Float64(y / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.25e+23) || ~((z <= 1.35e+60))) tmp = x - (y / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.25e+23], N[Not[LessEqual[z, 1.35e+60]], $MachinePrecision]], N[(x - N[(y / z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+23} \lor \neg \left(z \leq 1.35 \cdot 10^{+60}\right):\\
\;\;\;\;x - \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.25e23 or 1.35e60 < z Initial program 73.6%
Taylor expanded in y around 0 93.9%
if -1.25e23 < z < 1.35e60Initial program 93.5%
Taylor expanded in x around inf 79.5%
Final simplification85.4%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
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
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 85.3%
Taylor expanded in x around inf 80.3%
(FPCore (x y z t) :precision binary64 (- x (/ 1.0 (- (/ z y) (/ (/ t 2.0) z)))))
double code(double x, double y, double z, double t) {
return x - (1.0 / ((z / y) - ((t / 2.0) / z)));
}
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 - (1.0d0 / ((z / y) - ((t / 2.0d0) / z)))
end function
public static double code(double x, double y, double z, double t) {
return x - (1.0 / ((z / y) - ((t / 2.0) / z)));
}
def code(x, y, z, t): return x - (1.0 / ((z / y) - ((t / 2.0) / z)))
function code(x, y, z, t) return Float64(x - Float64(1.0 / Float64(Float64(z / y) - Float64(Float64(t / 2.0) / z)))) end
function tmp = code(x, y, z, t) tmp = x - (1.0 / ((z / y) - ((t / 2.0) / z))); end
code[x_, y_, z_, t_] := N[(x - N[(1.0 / N[(N[(z / y), $MachinePrecision] - N[(N[(t / 2.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{1}{\frac{z}{y} - \frac{\frac{t}{2}}{z}}
\end{array}
herbie shell --seed 2024096
(FPCore (x y z t)
:name "Numeric.AD.Rank1.Halley:findZero from ad-4.2.4"
:precision binary64
:alt
(- x (/ 1.0 (- (/ z y) (/ (/ t 2.0) z))))
(- x (/ (* (* y 2.0) z) (- (* (* z 2.0) z) (* y t)))))