
(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 (+ x (/ -2.0 (- (* z (/ 2.0 y)) (/ t z)))))
double code(double x, double y, double z, double t) {
return x + (-2.0 / ((z * (2.0 / y)) - (t / 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 + ((-2.0d0) / ((z * (2.0d0 / y)) - (t / z)))
end function
public static double code(double x, double y, double z, double t) {
return x + (-2.0 / ((z * (2.0 / y)) - (t / z)));
}
def code(x, y, z, t): return x + (-2.0 / ((z * (2.0 / y)) - (t / z)))
function code(x, y, z, t) return Float64(x + Float64(-2.0 / Float64(Float64(z * Float64(2.0 / y)) - Float64(t / z)))) end
function tmp = code(x, y, z, t) tmp = x + (-2.0 / ((z * (2.0 / y)) - (t / z))); end
code[x_, y_, z_, t_] := N[(x + N[(-2.0 / N[(N[(z * N[(2.0 / y), $MachinePrecision]), $MachinePrecision] - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{-2}{z \cdot \frac{2}{y} - \frac{t}{z}}
\end{array}
Initial program 82.7%
sub-neg82.7%
associate-/l*89.9%
*-commutative89.9%
associate-/l*89.8%
distribute-neg-frac89.8%
metadata-eval89.8%
associate-/l/82.7%
div-sub74.0%
times-frac87.3%
*-inverses87.3%
*-rgt-identity87.3%
*-commutative87.3%
associate-*l/87.3%
*-commutative87.3%
times-frac99.8%
*-inverses99.8%
*-lft-identity99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- x (/ y z))))
(if (<= z -2.5e+90)
t_1
(if (<= z -6.5e+29)
(* y (/ -2.0 (- (* z 2.0) (* y (/ t z)))))
(if (or (<= z -1.75e-65) (not (<= z 5.2e-45)))
t_1
(- x (/ z (* t -0.5))))))))
double code(double x, double y, double z, double t) {
double t_1 = x - (y / z);
double tmp;
if (z <= -2.5e+90) {
tmp = t_1;
} else if (z <= -6.5e+29) {
tmp = y * (-2.0 / ((z * 2.0) - (y * (t / z))));
} else if ((z <= -1.75e-65) || !(z <= 5.2e-45)) {
tmp = t_1;
} else {
tmp = x - (z / (t * -0.5));
}
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)
if (z <= (-2.5d+90)) then
tmp = t_1
else if (z <= (-6.5d+29)) then
tmp = y * ((-2.0d0) / ((z * 2.0d0) - (y * (t / z))))
else if ((z <= (-1.75d-65)) .or. (.not. (z <= 5.2d-45))) then
tmp = t_1
else
tmp = x - (z / (t * (-0.5d0)))
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 tmp;
if (z <= -2.5e+90) {
tmp = t_1;
} else if (z <= -6.5e+29) {
tmp = y * (-2.0 / ((z * 2.0) - (y * (t / z))));
} else if ((z <= -1.75e-65) || !(z <= 5.2e-45)) {
tmp = t_1;
} else {
tmp = x - (z / (t * -0.5));
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (y / z) tmp = 0 if z <= -2.5e+90: tmp = t_1 elif z <= -6.5e+29: tmp = y * (-2.0 / ((z * 2.0) - (y * (t / z)))) elif (z <= -1.75e-65) or not (z <= 5.2e-45): tmp = t_1 else: tmp = x - (z / (t * -0.5)) return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(y / z)) tmp = 0.0 if (z <= -2.5e+90) tmp = t_1; elseif (z <= -6.5e+29) tmp = Float64(y * Float64(-2.0 / Float64(Float64(z * 2.0) - Float64(y * Float64(t / z))))); elseif ((z <= -1.75e-65) || !(z <= 5.2e-45)) tmp = t_1; else tmp = Float64(x - Float64(z / Float64(t * -0.5))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (y / z); tmp = 0.0; if (z <= -2.5e+90) tmp = t_1; elseif (z <= -6.5e+29) tmp = y * (-2.0 / ((z * 2.0) - (y * (t / z)))); elseif ((z <= -1.75e-65) || ~((z <= 5.2e-45))) tmp = t_1; else tmp = x - (z / (t * -0.5)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.5e+90], t$95$1, If[LessEqual[z, -6.5e+29], N[(y * N[(-2.0 / N[(N[(z * 2.0), $MachinePrecision] - N[(y * N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -1.75e-65], N[Not[LessEqual[z, 5.2e-45]], $MachinePrecision]], t$95$1, N[(x - N[(z / N[(t * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y}{z}\\
\mathbf{if}\;z \leq -2.5 \cdot 10^{+90}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -6.5 \cdot 10^{+29}:\\
\;\;\;\;y \cdot \frac{-2}{z \cdot 2 - y \cdot \frac{t}{z}}\\
\mathbf{elif}\;z \leq -1.75 \cdot 10^{-65} \lor \neg \left(z \leq 5.2 \cdot 10^{-45}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x - \frac{z}{t \cdot -0.5}\\
\end{array}
\end{array}
if z < -2.5000000000000002e90 or -6.49999999999999971e29 < z < -1.75000000000000002e-65 or 5.19999999999999973e-45 < z Initial program 78.4%
sub-neg78.4%
associate-/l*88.5%
*-commutative88.5%
associate-/l*88.4%
distribute-neg-frac88.4%
metadata-eval88.4%
associate-/l/78.3%
div-sub77.6%
times-frac88.8%
*-inverses88.8%
*-rgt-identity88.8%
*-commutative88.8%
associate-*l/88.7%
*-commutative88.7%
times-frac99.8%
*-inverses99.8%
*-lft-identity99.8%
Simplified99.8%
Taylor expanded in z around inf 88.5%
+-commutative88.5%
mul-1-neg88.5%
sub-neg88.5%
Simplified88.5%
if -2.5000000000000002e90 < z < -6.49999999999999971e29Initial program 91.1%
associate-/l*100.0%
*-commutative100.0%
associate-*r/100.0%
div-sub100.0%
*-commutative100.0%
associate-/l*100.0%
associate-/r*100.0%
*-inverses100.0%
metadata-eval100.0%
*-commutative100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 82.4%
associate-*r/82.4%
*-commutative82.4%
Simplified82.4%
expm1-log1p-u54.3%
expm1-udef18.3%
*-un-lft-identity18.3%
times-frac18.3%
metadata-eval18.3%
*-commutative18.3%
associate-/l*18.3%
div-inv18.3%
clear-num18.3%
Applied egg-rr18.3%
expm1-def54.3%
expm1-log1p82.1%
associate-*r/82.1%
*-commutative82.1%
associate-*r/82.0%
associate-*r/82.2%
*-commutative82.2%
associate-*r/82.1%
Simplified82.1%
if -1.75000000000000002e-65 < z < 5.19999999999999973e-45Initial program 87.9%
*-commutative87.9%
associate-/l*91.8%
div-sub91.7%
sub-neg91.7%
*-commutative91.7%
associate-*l*91.7%
*-commutative91.7%
times-frac91.7%
metadata-eval91.7%
*-lft-identity91.7%
associate-*r/95.6%
fma-def95.6%
associate-/r*95.6%
distribute-neg-frac95.6%
*-commutative95.6%
associate-/l*100.0%
*-inverses100.0%
/-rgt-identity100.0%
Simplified100.0%
Taylor expanded in z around 0 93.3%
*-commutative93.3%
Simplified93.3%
Final simplification90.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- x (/ y z))))
(if (<= z -2.5e+90)
t_1
(if (<= z -6.5e+29)
(/ -2.0 (- (* 2.0 (/ z y)) (/ t z)))
(if (or (<= z -1.75e-68) (not (<= z 1.3e-44)))
t_1
(- x (/ z (* t -0.5))))))))
double code(double x, double y, double z, double t) {
double t_1 = x - (y / z);
double tmp;
if (z <= -2.5e+90) {
tmp = t_1;
} else if (z <= -6.5e+29) {
tmp = -2.0 / ((2.0 * (z / y)) - (t / z));
} else if ((z <= -1.75e-68) || !(z <= 1.3e-44)) {
tmp = t_1;
} else {
tmp = x - (z / (t * -0.5));
}
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)
if (z <= (-2.5d+90)) then
tmp = t_1
else if (z <= (-6.5d+29)) then
tmp = (-2.0d0) / ((2.0d0 * (z / y)) - (t / z))
else if ((z <= (-1.75d-68)) .or. (.not. (z <= 1.3d-44))) then
tmp = t_1
else
tmp = x - (z / (t * (-0.5d0)))
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 tmp;
if (z <= -2.5e+90) {
tmp = t_1;
} else if (z <= -6.5e+29) {
tmp = -2.0 / ((2.0 * (z / y)) - (t / z));
} else if ((z <= -1.75e-68) || !(z <= 1.3e-44)) {
tmp = t_1;
} else {
tmp = x - (z / (t * -0.5));
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (y / z) tmp = 0 if z <= -2.5e+90: tmp = t_1 elif z <= -6.5e+29: tmp = -2.0 / ((2.0 * (z / y)) - (t / z)) elif (z <= -1.75e-68) or not (z <= 1.3e-44): tmp = t_1 else: tmp = x - (z / (t * -0.5)) return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(y / z)) tmp = 0.0 if (z <= -2.5e+90) tmp = t_1; elseif (z <= -6.5e+29) tmp = Float64(-2.0 / Float64(Float64(2.0 * Float64(z / y)) - Float64(t / z))); elseif ((z <= -1.75e-68) || !(z <= 1.3e-44)) tmp = t_1; else tmp = Float64(x - Float64(z / Float64(t * -0.5))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (y / z); tmp = 0.0; if (z <= -2.5e+90) tmp = t_1; elseif (z <= -6.5e+29) tmp = -2.0 / ((2.0 * (z / y)) - (t / z)); elseif ((z <= -1.75e-68) || ~((z <= 1.3e-44))) tmp = t_1; else tmp = x - (z / (t * -0.5)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.5e+90], t$95$1, If[LessEqual[z, -6.5e+29], N[(-2.0 / N[(N[(2.0 * N[(z / y), $MachinePrecision]), $MachinePrecision] - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -1.75e-68], N[Not[LessEqual[z, 1.3e-44]], $MachinePrecision]], t$95$1, N[(x - N[(z / N[(t * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y}{z}\\
\mathbf{if}\;z \leq -2.5 \cdot 10^{+90}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -6.5 \cdot 10^{+29}:\\
\;\;\;\;\frac{-2}{2 \cdot \frac{z}{y} - \frac{t}{z}}\\
\mathbf{elif}\;z \leq -1.75 \cdot 10^{-68} \lor \neg \left(z \leq 1.3 \cdot 10^{-44}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x - \frac{z}{t \cdot -0.5}\\
\end{array}
\end{array}
if z < -2.5000000000000002e90 or -6.49999999999999971e29 < z < -1.75000000000000006e-68 or 1.2999999999999999e-44 < z Initial program 78.4%
sub-neg78.4%
associate-/l*88.5%
*-commutative88.5%
associate-/l*88.4%
distribute-neg-frac88.4%
metadata-eval88.4%
associate-/l/78.3%
div-sub77.6%
times-frac88.8%
*-inverses88.8%
*-rgt-identity88.8%
*-commutative88.8%
associate-*l/88.7%
*-commutative88.7%
times-frac99.8%
*-inverses99.8%
*-lft-identity99.8%
Simplified99.8%
Taylor expanded in z around inf 88.5%
+-commutative88.5%
mul-1-neg88.5%
sub-neg88.5%
Simplified88.5%
if -2.5000000000000002e90 < z < -6.49999999999999971e29Initial program 91.1%
sub-neg91.1%
associate-/l*100.0%
*-commutative100.0%
associate-/l*99.7%
distribute-neg-frac99.7%
metadata-eval99.7%
associate-/l/90.9%
div-sub90.9%
times-frac91.4%
*-inverses91.4%
*-rgt-identity91.4%
*-commutative91.4%
associate-*l/91.4%
*-commutative91.4%
times-frac99.7%
*-inverses99.7%
*-lft-identity99.7%
Simplified99.7%
Taylor expanded in x around 0 82.0%
if -1.75000000000000006e-68 < z < 1.2999999999999999e-44Initial program 87.9%
*-commutative87.9%
associate-/l*91.8%
div-sub91.7%
sub-neg91.7%
*-commutative91.7%
associate-*l*91.7%
*-commutative91.7%
times-frac91.7%
metadata-eval91.7%
*-lft-identity91.7%
associate-*r/95.6%
fma-def95.6%
associate-/r*95.6%
distribute-neg-frac95.6%
*-commutative95.6%
associate-/l*100.0%
*-inverses100.0%
/-rgt-identity100.0%
Simplified100.0%
Taylor expanded in z around 0 93.3%
*-commutative93.3%
Simplified93.3%
Final simplification90.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8.5e-72) (not (<= z 1.3e-44))) (- x (/ y z)) (- x (/ z (* t -0.5)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.5e-72) || !(z <= 1.3e-44)) {
tmp = x - (y / z);
} else {
tmp = x - (z / (t * -0.5));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-8.5d-72)) .or. (.not. (z <= 1.3d-44))) then
tmp = x - (y / z)
else
tmp = x - (z / (t * (-0.5d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.5e-72) || !(z <= 1.3e-44)) {
tmp = x - (y / z);
} else {
tmp = x - (z / (t * -0.5));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -8.5e-72) or not (z <= 1.3e-44): tmp = x - (y / z) else: tmp = x - (z / (t * -0.5)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -8.5e-72) || !(z <= 1.3e-44)) tmp = Float64(x - Float64(y / z)); else tmp = Float64(x - Float64(z / Float64(t * -0.5))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -8.5e-72) || ~((z <= 1.3e-44))) tmp = x - (y / z); else tmp = x - (z / (t * -0.5)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -8.5e-72], N[Not[LessEqual[z, 1.3e-44]], $MachinePrecision]], N[(x - N[(y / z), $MachinePrecision]), $MachinePrecision], N[(x - N[(z / N[(t * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{-72} \lor \neg \left(z \leq 1.3 \cdot 10^{-44}\right):\\
\;\;\;\;x - \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{z}{t \cdot -0.5}\\
\end{array}
\end{array}
if z < -8.50000000000000008e-72 or 1.2999999999999999e-44 < z Initial program 79.3%
sub-neg79.3%
associate-/l*89.3%
*-commutative89.3%
associate-/l*89.2%
distribute-neg-frac89.2%
metadata-eval89.2%
associate-/l/79.2%
div-sub78.5%
times-frac89.0%
*-inverses89.0%
*-rgt-identity89.0%
*-commutative89.0%
associate-*l/88.9%
*-commutative88.9%
times-frac99.8%
*-inverses99.8%
*-lft-identity99.8%
Simplified99.8%
Taylor expanded in z around inf 84.9%
+-commutative84.9%
mul-1-neg84.9%
sub-neg84.9%
Simplified84.9%
if -8.50000000000000008e-72 < z < 1.2999999999999999e-44Initial program 87.9%
*-commutative87.9%
associate-/l*91.8%
div-sub91.7%
sub-neg91.7%
*-commutative91.7%
associate-*l*91.7%
*-commutative91.7%
times-frac91.7%
metadata-eval91.7%
*-lft-identity91.7%
associate-*r/95.6%
fma-def95.6%
associate-/r*95.6%
distribute-neg-frac95.6%
*-commutative95.6%
associate-/l*100.0%
*-inverses100.0%
/-rgt-identity100.0%
Simplified100.0%
Taylor expanded in z around 0 93.3%
*-commutative93.3%
Simplified93.3%
Final simplification88.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.5e-67) (not (<= z 60000000000.0))) (- x (/ y z)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.5e-67) || !(z <= 60000000000.0)) {
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 <= (-2.5d-67)) .or. (.not. (z <= 60000000000.0d0))) 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 <= -2.5e-67) || !(z <= 60000000000.0)) {
tmp = x - (y / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.5e-67) or not (z <= 60000000000.0): tmp = x - (y / z) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.5e-67) || !(z <= 60000000000.0)) 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 <= -2.5e-67) || ~((z <= 60000000000.0))) tmp = x - (y / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.5e-67], N[Not[LessEqual[z, 60000000000.0]], $MachinePrecision]], N[(x - N[(y / z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{-67} \lor \neg \left(z \leq 60000000000\right):\\
\;\;\;\;x - \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.4999999999999999e-67 or 6e10 < z Initial program 77.9%
sub-neg77.9%
associate-/l*88.2%
*-commutative88.2%
associate-/l*88.2%
distribute-neg-frac88.2%
metadata-eval88.2%
associate-/l/77.9%
div-sub77.1%
times-frac88.6%
*-inverses88.6%
*-rgt-identity88.6%
*-commutative88.6%
associate-*l/88.5%
*-commutative88.5%
times-frac99.8%
*-inverses99.8%
*-lft-identity99.8%
Simplified99.8%
Taylor expanded in z around inf 86.1%
+-commutative86.1%
mul-1-neg86.1%
sub-neg86.1%
Simplified86.1%
if -2.4999999999999999e-67 < z < 6e10Initial program 88.5%
sub-neg88.5%
associate-/l*91.9%
*-commutative91.9%
associate-/l*91.9%
distribute-neg-frac91.9%
metadata-eval91.9%
associate-/l/88.5%
div-sub70.2%
times-frac85.8%
*-inverses85.8%
*-rgt-identity85.8%
*-commutative85.8%
associate-*l/85.8%
*-commutative85.8%
times-frac99.9%
*-inverses99.9%
*-lft-identity99.9%
Simplified99.9%
Taylor expanded in x around inf 77.9%
Final simplification82.4%
(FPCore (x y z t) :precision binary64 (if (<= x -2.8e-234) x (if (<= x 4.8e-251) (* 2.0 (/ z t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.8e-234) {
tmp = x;
} else if (x <= 4.8e-251) {
tmp = 2.0 * (z / t);
} 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 (x <= (-2.8d-234)) then
tmp = x
else if (x <= 4.8d-251) then
tmp = 2.0d0 * (z / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.8e-234) {
tmp = x;
} else if (x <= 4.8e-251) {
tmp = 2.0 * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.8e-234: tmp = x elif x <= 4.8e-251: tmp = 2.0 * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.8e-234) tmp = x; elseif (x <= 4.8e-251) tmp = Float64(2.0 * Float64(z / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.8e-234) tmp = x; elseif (x <= 4.8e-251) tmp = 2.0 * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.8e-234], x, If[LessEqual[x, 4.8e-251], N[(2.0 * N[(z / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{-234}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{-251}:\\
\;\;\;\;2 \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.7999999999999999e-234 or 4.79999999999999992e-251 < x Initial program 84.7%
sub-neg84.7%
associate-/l*92.0%
*-commutative92.0%
associate-/l*92.0%
distribute-neg-frac92.0%
metadata-eval92.0%
associate-/l/84.6%
div-sub74.6%
times-frac89.1%
*-inverses89.1%
*-rgt-identity89.1%
*-commutative89.1%
associate-*l/89.1%
*-commutative89.1%
times-frac99.9%
*-inverses99.9%
*-lft-identity99.9%
Simplified99.9%
Taylor expanded in x around inf 80.8%
if -2.7999999999999999e-234 < x < 4.79999999999999992e-251Initial program 70.5%
*-commutative70.5%
associate-/l*79.1%
div-sub79.0%
sub-neg79.0%
*-commutative79.0%
associate-*l*79.0%
*-commutative79.0%
times-frac79.0%
metadata-eval79.0%
*-lft-identity79.0%
associate-*r/81.8%
fma-def81.8%
associate-/r*81.8%
distribute-neg-frac81.8%
*-commutative81.8%
associate-/l*91.6%
*-inverses91.6%
/-rgt-identity91.6%
Simplified91.6%
Taylor expanded in z around 0 57.8%
*-commutative57.8%
Simplified57.8%
Taylor expanded in x around 0 52.5%
*-commutative52.5%
Simplified52.5%
Final simplification77.0%
(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 82.7%
sub-neg82.7%
associate-/l*89.9%
*-commutative89.9%
associate-/l*89.8%
distribute-neg-frac89.8%
metadata-eval89.8%
associate-/l/82.7%
div-sub74.0%
times-frac87.3%
*-inverses87.3%
*-rgt-identity87.3%
*-commutative87.3%
associate-*l/87.3%
*-commutative87.3%
times-frac99.8%
*-inverses99.8%
*-lft-identity99.8%
Simplified99.8%
Taylor expanded in x around inf 72.6%
Final simplification72.6%
(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 2023230
(FPCore (x y z t)
:name "Numeric.AD.Rank1.Halley:findZero from ad-4.2.4"
:precision binary64
:herbie-target
(- x (/ 1.0 (- (/ z y) (/ (/ t 2.0) z))))
(- x (/ (* (* y 2.0) z) (- (* (* z 2.0) z) (* y t)))))