
(FPCore (x y z) :precision binary64 (/ (+ x y) (- 1.0 (/ y z))))
double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + y) / (1.0d0 - (y / z))
end function
public static double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
def code(x, y, z): return (x + y) / (1.0 - (y / z))
function code(x, y, z) return Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))) end
function tmp = code(x, y, z) tmp = (x + y) / (1.0 - (y / z)); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y}{1 - \frac{y}{z}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (+ x y) (- 1.0 (/ y z))))
double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + y) / (1.0d0 - (y / z))
end function
public static double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
def code(x, y, z): return (x + y) / (1.0 - (y / z))
function code(x, y, z) return Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))) end
function tmp = code(x, y, z) tmp = (x + y) / (1.0 - (y / z)); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y}{1 - \frac{y}{z}}
\end{array}
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (+ x y) (- 1.0 (/ y z))))) (if (or (<= t_0 -2e-262) (not (<= t_0 0.0))) t_0 (- (- z) (/ (* x z) y)))))
double code(double x, double y, double z) {
double t_0 = (x + y) / (1.0 - (y / z));
double tmp;
if ((t_0 <= -2e-262) || !(t_0 <= 0.0)) {
tmp = t_0;
} else {
tmp = -z - ((x * z) / y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (x + y) / (1.0d0 - (y / z))
if ((t_0 <= (-2d-262)) .or. (.not. (t_0 <= 0.0d0))) then
tmp = t_0
else
tmp = -z - ((x * z) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + y) / (1.0 - (y / z));
double tmp;
if ((t_0 <= -2e-262) || !(t_0 <= 0.0)) {
tmp = t_0;
} else {
tmp = -z - ((x * z) / y);
}
return tmp;
}
def code(x, y, z): t_0 = (x + y) / (1.0 - (y / z)) tmp = 0 if (t_0 <= -2e-262) or not (t_0 <= 0.0): tmp = t_0 else: tmp = -z - ((x * z) / y) return tmp
function code(x, y, z) t_0 = Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))) tmp = 0.0 if ((t_0 <= -2e-262) || !(t_0 <= 0.0)) tmp = t_0; else tmp = Float64(Float64(-z) - Float64(Float64(x * z) / y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + y) / (1.0 - (y / z)); tmp = 0.0; if ((t_0 <= -2e-262) || ~((t_0 <= 0.0))) tmp = t_0; else tmp = -z - ((x * z) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -2e-262], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], t$95$0, N[((-z) - N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + y}{1 - \frac{y}{z}}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-262} \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(-z\right) - \frac{x \cdot z}{y}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -2.00000000000000002e-262 or -0.0 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) Initial program 99.9%
if -2.00000000000000002e-262 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -0.0Initial program 12.9%
Taylor expanded in y around inf 12.9%
neg-mul-112.9%
distribute-neg-frac212.9%
Simplified12.9%
Taylor expanded in x around 0 100.0%
mul-1-neg100.0%
unsub-neg100.0%
mul-1-neg100.0%
associate-/l*80.4%
Simplified80.4%
Taylor expanded in x around 0 100.0%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (- -1.0 (/ x y)))) (t_1 (- 1.0 (/ y z))) (t_2 (/ x t_1)))
(if (<= y -1.4e+38)
t_0
(if (<= y -5.8e-10)
(+ x y)
(if (<= y -2.45e-54)
(- (- z) (* x (/ z y)))
(if (<= y -4.7e-200)
(+ x y)
(if (<= y 18000000000.0)
t_2
(if (<= y 1.4e+41) (/ y t_1) (if (<= y 1.45e+56) t_2 t_0)))))))))
double code(double x, double y, double z) {
double t_0 = z * (-1.0 - (x / y));
double t_1 = 1.0 - (y / z);
double t_2 = x / t_1;
double tmp;
if (y <= -1.4e+38) {
tmp = t_0;
} else if (y <= -5.8e-10) {
tmp = x + y;
} else if (y <= -2.45e-54) {
tmp = -z - (x * (z / y));
} else if (y <= -4.7e-200) {
tmp = x + y;
} else if (y <= 18000000000.0) {
tmp = t_2;
} else if (y <= 1.4e+41) {
tmp = y / t_1;
} else if (y <= 1.45e+56) {
tmp = t_2;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = z * ((-1.0d0) - (x / y))
t_1 = 1.0d0 - (y / z)
t_2 = x / t_1
if (y <= (-1.4d+38)) then
tmp = t_0
else if (y <= (-5.8d-10)) then
tmp = x + y
else if (y <= (-2.45d-54)) then
tmp = -z - (x * (z / y))
else if (y <= (-4.7d-200)) then
tmp = x + y
else if (y <= 18000000000.0d0) then
tmp = t_2
else if (y <= 1.4d+41) then
tmp = y / t_1
else if (y <= 1.45d+56) then
tmp = t_2
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (-1.0 - (x / y));
double t_1 = 1.0 - (y / z);
double t_2 = x / t_1;
double tmp;
if (y <= -1.4e+38) {
tmp = t_0;
} else if (y <= -5.8e-10) {
tmp = x + y;
} else if (y <= -2.45e-54) {
tmp = -z - (x * (z / y));
} else if (y <= -4.7e-200) {
tmp = x + y;
} else if (y <= 18000000000.0) {
tmp = t_2;
} else if (y <= 1.4e+41) {
tmp = y / t_1;
} else if (y <= 1.45e+56) {
tmp = t_2;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (-1.0 - (x / y)) t_1 = 1.0 - (y / z) t_2 = x / t_1 tmp = 0 if y <= -1.4e+38: tmp = t_0 elif y <= -5.8e-10: tmp = x + y elif y <= -2.45e-54: tmp = -z - (x * (z / y)) elif y <= -4.7e-200: tmp = x + y elif y <= 18000000000.0: tmp = t_2 elif y <= 1.4e+41: tmp = y / t_1 elif y <= 1.45e+56: tmp = t_2 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(-1.0 - Float64(x / y))) t_1 = Float64(1.0 - Float64(y / z)) t_2 = Float64(x / t_1) tmp = 0.0 if (y <= -1.4e+38) tmp = t_0; elseif (y <= -5.8e-10) tmp = Float64(x + y); elseif (y <= -2.45e-54) tmp = Float64(Float64(-z) - Float64(x * Float64(z / y))); elseif (y <= -4.7e-200) tmp = Float64(x + y); elseif (y <= 18000000000.0) tmp = t_2; elseif (y <= 1.4e+41) tmp = Float64(y / t_1); elseif (y <= 1.45e+56) tmp = t_2; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (-1.0 - (x / y)); t_1 = 1.0 - (y / z); t_2 = x / t_1; tmp = 0.0; if (y <= -1.4e+38) tmp = t_0; elseif (y <= -5.8e-10) tmp = x + y; elseif (y <= -2.45e-54) tmp = -z - (x * (z / y)); elseif (y <= -4.7e-200) tmp = x + y; elseif (y <= 18000000000.0) tmp = t_2; elseif (y <= 1.4e+41) tmp = y / t_1; elseif (y <= 1.45e+56) tmp = t_2; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x / t$95$1), $MachinePrecision]}, If[LessEqual[y, -1.4e+38], t$95$0, If[LessEqual[y, -5.8e-10], N[(x + y), $MachinePrecision], If[LessEqual[y, -2.45e-54], N[((-z) - N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -4.7e-200], N[(x + y), $MachinePrecision], If[LessEqual[y, 18000000000.0], t$95$2, If[LessEqual[y, 1.4e+41], N[(y / t$95$1), $MachinePrecision], If[LessEqual[y, 1.45e+56], t$95$2, t$95$0]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(-1 - \frac{x}{y}\right)\\
t_1 := 1 - \frac{y}{z}\\
t_2 := \frac{x}{t\_1}\\
\mathbf{if}\;y \leq -1.4 \cdot 10^{+38}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-10}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq -2.45 \cdot 10^{-54}:\\
\;\;\;\;\left(-z\right) - x \cdot \frac{z}{y}\\
\mathbf{elif}\;y \leq -4.7 \cdot 10^{-200}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 18000000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+41}:\\
\;\;\;\;\frac{y}{t\_1}\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{+56}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.4e38 or 1.45000000000000004e56 < y Initial program 77.0%
Taylor expanded in y around inf 60.9%
neg-mul-160.9%
distribute-neg-frac260.9%
Simplified60.9%
Taylor expanded in x around 0 79.0%
mul-1-neg79.0%
unsub-neg79.0%
mul-1-neg79.0%
associate-/l*78.8%
Simplified78.8%
Taylor expanded in x around 0 79.0%
Taylor expanded in z around 0 83.8%
mul-1-neg83.8%
distribute-rgt-neg-in83.8%
distribute-neg-in83.8%
metadata-eval83.8%
mul-1-neg83.8%
mul-1-neg83.8%
unsub-neg83.8%
Simplified83.8%
if -1.4e38 < y < -5.79999999999999962e-10 or -2.4500000000000001e-54 < y < -4.7000000000000001e-200Initial program 99.9%
Taylor expanded in z around inf 75.0%
+-commutative75.0%
Simplified75.0%
if -5.79999999999999962e-10 < y < -2.4500000000000001e-54Initial program 100.0%
Taylor expanded in y around inf 81.1%
neg-mul-181.1%
distribute-neg-frac281.1%
Simplified81.1%
Taylor expanded in x around 0 81.0%
mul-1-neg81.0%
unsub-neg81.0%
mul-1-neg81.0%
associate-/l*81.0%
Simplified81.0%
if -4.7000000000000001e-200 < y < 1.8e10 or 1.4e41 < y < 1.45000000000000004e56Initial program 99.9%
Taylor expanded in x around inf 84.5%
if 1.8e10 < y < 1.4e41Initial program 100.0%
Taylor expanded in x around 0 85.9%
Final simplification82.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (- -1.0 (/ x y)))) (t_1 (- 1.0 (/ y z))) (t_2 (/ x t_1)))
(if (<= y -1.3e+38)
t_0
(if (<= y -3.5e-7)
(+ x y)
(if (<= y -2.8e-56)
t_0
(if (<= y -1.6e-200)
(+ x y)
(if (<= y 34000000000.0)
t_2
(if (<= y 1.2e+40) (/ y t_1) (if (<= y 1.85e+56) t_2 t_0)))))))))
double code(double x, double y, double z) {
double t_0 = z * (-1.0 - (x / y));
double t_1 = 1.0 - (y / z);
double t_2 = x / t_1;
double tmp;
if (y <= -1.3e+38) {
tmp = t_0;
} else if (y <= -3.5e-7) {
tmp = x + y;
} else if (y <= -2.8e-56) {
tmp = t_0;
} else if (y <= -1.6e-200) {
tmp = x + y;
} else if (y <= 34000000000.0) {
tmp = t_2;
} else if (y <= 1.2e+40) {
tmp = y / t_1;
} else if (y <= 1.85e+56) {
tmp = t_2;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = z * ((-1.0d0) - (x / y))
t_1 = 1.0d0 - (y / z)
t_2 = x / t_1
if (y <= (-1.3d+38)) then
tmp = t_0
else if (y <= (-3.5d-7)) then
tmp = x + y
else if (y <= (-2.8d-56)) then
tmp = t_0
else if (y <= (-1.6d-200)) then
tmp = x + y
else if (y <= 34000000000.0d0) then
tmp = t_2
else if (y <= 1.2d+40) then
tmp = y / t_1
else if (y <= 1.85d+56) then
tmp = t_2
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (-1.0 - (x / y));
double t_1 = 1.0 - (y / z);
double t_2 = x / t_1;
double tmp;
if (y <= -1.3e+38) {
tmp = t_0;
} else if (y <= -3.5e-7) {
tmp = x + y;
} else if (y <= -2.8e-56) {
tmp = t_0;
} else if (y <= -1.6e-200) {
tmp = x + y;
} else if (y <= 34000000000.0) {
tmp = t_2;
} else if (y <= 1.2e+40) {
tmp = y / t_1;
} else if (y <= 1.85e+56) {
tmp = t_2;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (-1.0 - (x / y)) t_1 = 1.0 - (y / z) t_2 = x / t_1 tmp = 0 if y <= -1.3e+38: tmp = t_0 elif y <= -3.5e-7: tmp = x + y elif y <= -2.8e-56: tmp = t_0 elif y <= -1.6e-200: tmp = x + y elif y <= 34000000000.0: tmp = t_2 elif y <= 1.2e+40: tmp = y / t_1 elif y <= 1.85e+56: tmp = t_2 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(-1.0 - Float64(x / y))) t_1 = Float64(1.0 - Float64(y / z)) t_2 = Float64(x / t_1) tmp = 0.0 if (y <= -1.3e+38) tmp = t_0; elseif (y <= -3.5e-7) tmp = Float64(x + y); elseif (y <= -2.8e-56) tmp = t_0; elseif (y <= -1.6e-200) tmp = Float64(x + y); elseif (y <= 34000000000.0) tmp = t_2; elseif (y <= 1.2e+40) tmp = Float64(y / t_1); elseif (y <= 1.85e+56) tmp = t_2; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (-1.0 - (x / y)); t_1 = 1.0 - (y / z); t_2 = x / t_1; tmp = 0.0; if (y <= -1.3e+38) tmp = t_0; elseif (y <= -3.5e-7) tmp = x + y; elseif (y <= -2.8e-56) tmp = t_0; elseif (y <= -1.6e-200) tmp = x + y; elseif (y <= 34000000000.0) tmp = t_2; elseif (y <= 1.2e+40) tmp = y / t_1; elseif (y <= 1.85e+56) tmp = t_2; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x / t$95$1), $MachinePrecision]}, If[LessEqual[y, -1.3e+38], t$95$0, If[LessEqual[y, -3.5e-7], N[(x + y), $MachinePrecision], If[LessEqual[y, -2.8e-56], t$95$0, If[LessEqual[y, -1.6e-200], N[(x + y), $MachinePrecision], If[LessEqual[y, 34000000000.0], t$95$2, If[LessEqual[y, 1.2e+40], N[(y / t$95$1), $MachinePrecision], If[LessEqual[y, 1.85e+56], t$95$2, t$95$0]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(-1 - \frac{x}{y}\right)\\
t_1 := 1 - \frac{y}{z}\\
t_2 := \frac{x}{t\_1}\\
\mathbf{if}\;y \leq -1.3 \cdot 10^{+38}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -3.5 \cdot 10^{-7}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq -2.8 \cdot 10^{-56}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -1.6 \cdot 10^{-200}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 34000000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+40}:\\
\;\;\;\;\frac{y}{t\_1}\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{+56}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.3e38 or -3.49999999999999984e-7 < y < -2.79999999999999993e-56 or 1.84999999999999998e56 < y Initial program 79.1%
Taylor expanded in y around inf 62.8%
neg-mul-162.8%
distribute-neg-frac262.8%
Simplified62.8%
Taylor expanded in x around 0 79.1%
mul-1-neg79.1%
unsub-neg79.1%
mul-1-neg79.1%
associate-/l*79.0%
Simplified79.0%
Taylor expanded in x around 0 79.1%
Taylor expanded in z around 0 83.6%
mul-1-neg83.6%
distribute-rgt-neg-in83.6%
distribute-neg-in83.6%
metadata-eval83.6%
mul-1-neg83.6%
mul-1-neg83.6%
unsub-neg83.6%
Simplified83.6%
if -1.3e38 < y < -3.49999999999999984e-7 or -2.79999999999999993e-56 < y < -1.59999999999999991e-200Initial program 99.9%
Taylor expanded in z around inf 75.0%
+-commutative75.0%
Simplified75.0%
if -1.59999999999999991e-200 < y < 3.4e10 or 1.2e40 < y < 1.84999999999999998e56Initial program 99.9%
Taylor expanded in x around inf 84.5%
if 3.4e10 < y < 1.2e40Initial program 100.0%
Taylor expanded in x around 0 85.9%
Final simplification82.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (- -1.0 (/ x y)))))
(if (<= y -2.5e+38)
t_0
(if (<= y -1e-9)
(+ x y)
(if (<= y -4.5e-54)
t_0
(if (<= y -2.6e-200)
(+ x y)
(if (<= y 8e+56) (/ x (- 1.0 (/ y z))) t_0)))))))
double code(double x, double y, double z) {
double t_0 = z * (-1.0 - (x / y));
double tmp;
if (y <= -2.5e+38) {
tmp = t_0;
} else if (y <= -1e-9) {
tmp = x + y;
} else if (y <= -4.5e-54) {
tmp = t_0;
} else if (y <= -2.6e-200) {
tmp = x + y;
} else if (y <= 8e+56) {
tmp = x / (1.0 - (y / z));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = z * ((-1.0d0) - (x / y))
if (y <= (-2.5d+38)) then
tmp = t_0
else if (y <= (-1d-9)) then
tmp = x + y
else if (y <= (-4.5d-54)) then
tmp = t_0
else if (y <= (-2.6d-200)) then
tmp = x + y
else if (y <= 8d+56) then
tmp = x / (1.0d0 - (y / z))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (-1.0 - (x / y));
double tmp;
if (y <= -2.5e+38) {
tmp = t_0;
} else if (y <= -1e-9) {
tmp = x + y;
} else if (y <= -4.5e-54) {
tmp = t_0;
} else if (y <= -2.6e-200) {
tmp = x + y;
} else if (y <= 8e+56) {
tmp = x / (1.0 - (y / z));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (-1.0 - (x / y)) tmp = 0 if y <= -2.5e+38: tmp = t_0 elif y <= -1e-9: tmp = x + y elif y <= -4.5e-54: tmp = t_0 elif y <= -2.6e-200: tmp = x + y elif y <= 8e+56: tmp = x / (1.0 - (y / z)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(-1.0 - Float64(x / y))) tmp = 0.0 if (y <= -2.5e+38) tmp = t_0; elseif (y <= -1e-9) tmp = Float64(x + y); elseif (y <= -4.5e-54) tmp = t_0; elseif (y <= -2.6e-200) tmp = Float64(x + y); elseif (y <= 8e+56) tmp = Float64(x / Float64(1.0 - Float64(y / z))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (-1.0 - (x / y)); tmp = 0.0; if (y <= -2.5e+38) tmp = t_0; elseif (y <= -1e-9) tmp = x + y; elseif (y <= -4.5e-54) tmp = t_0; elseif (y <= -2.6e-200) tmp = x + y; elseif (y <= 8e+56) tmp = x / (1.0 - (y / z)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.5e+38], t$95$0, If[LessEqual[y, -1e-9], N[(x + y), $MachinePrecision], If[LessEqual[y, -4.5e-54], t$95$0, If[LessEqual[y, -2.6e-200], N[(x + y), $MachinePrecision], If[LessEqual[y, 8e+56], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(-1 - \frac{x}{y}\right)\\
\mathbf{if}\;y \leq -2.5 \cdot 10^{+38}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -1 \cdot 10^{-9}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq -4.5 \cdot 10^{-54}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -2.6 \cdot 10^{-200}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+56}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -2.49999999999999985e38 or -1.00000000000000006e-9 < y < -4.4999999999999998e-54 or 8.00000000000000074e56 < y Initial program 79.1%
Taylor expanded in y around inf 62.8%
neg-mul-162.8%
distribute-neg-frac262.8%
Simplified62.8%
Taylor expanded in x around 0 79.1%
mul-1-neg79.1%
unsub-neg79.1%
mul-1-neg79.1%
associate-/l*79.0%
Simplified79.0%
Taylor expanded in x around 0 79.1%
Taylor expanded in z around 0 83.6%
mul-1-neg83.6%
distribute-rgt-neg-in83.6%
distribute-neg-in83.6%
metadata-eval83.6%
mul-1-neg83.6%
mul-1-neg83.6%
unsub-neg83.6%
Simplified83.6%
if -2.49999999999999985e38 < y < -1.00000000000000006e-9 or -4.4999999999999998e-54 < y < -2.5999999999999999e-200Initial program 99.9%
Taylor expanded in z around inf 75.0%
+-commutative75.0%
Simplified75.0%
if -2.5999999999999999e-200 < y < 8.00000000000000074e56Initial program 99.9%
Taylor expanded in x around inf 80.1%
Final simplification80.8%
(FPCore (x y z)
:precision binary64
(if (or (<= y -5e+37)
(not (or (<= y -1.25e-8) (and (not (<= y -9.5e-55)) (<= y 8e+39)))))
(* z (- -1.0 (/ x y)))
(+ x y)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -5e+37) || !((y <= -1.25e-8) || (!(y <= -9.5e-55) && (y <= 8e+39)))) {
tmp = z * (-1.0 - (x / y));
} else {
tmp = x + y;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-5d+37)) .or. (.not. (y <= (-1.25d-8)) .or. (.not. (y <= (-9.5d-55))) .and. (y <= 8d+39))) then
tmp = z * ((-1.0d0) - (x / y))
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -5e+37) || !((y <= -1.25e-8) || (!(y <= -9.5e-55) && (y <= 8e+39)))) {
tmp = z * (-1.0 - (x / y));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -5e+37) or not ((y <= -1.25e-8) or (not (y <= -9.5e-55) and (y <= 8e+39))): tmp = z * (-1.0 - (x / y)) else: tmp = x + y return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -5e+37) || !((y <= -1.25e-8) || (!(y <= -9.5e-55) && (y <= 8e+39)))) tmp = Float64(z * Float64(-1.0 - Float64(x / y))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -5e+37) || ~(((y <= -1.25e-8) || (~((y <= -9.5e-55)) && (y <= 8e+39))))) tmp = z * (-1.0 - (x / y)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -5e+37], N[Not[Or[LessEqual[y, -1.25e-8], And[N[Not[LessEqual[y, -9.5e-55]], $MachinePrecision], LessEqual[y, 8e+39]]]], $MachinePrecision]], N[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+37} \lor \neg \left(y \leq -1.25 \cdot 10^{-8} \lor \neg \left(y \leq -9.5 \cdot 10^{-55}\right) \land y \leq 8 \cdot 10^{+39}\right):\\
\;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if y < -4.99999999999999989e37 or -1.2499999999999999e-8 < y < -9.5000000000000006e-55 or 7.99999999999999952e39 < y Initial program 80.7%
Taylor expanded in y around inf 62.9%
neg-mul-162.9%
distribute-neg-frac262.9%
Simplified62.9%
Taylor expanded in x around 0 77.6%
mul-1-neg77.6%
unsub-neg77.6%
mul-1-neg77.6%
associate-/l*77.9%
Simplified77.9%
Taylor expanded in x around 0 77.6%
Taylor expanded in z around 0 82.1%
mul-1-neg82.1%
distribute-rgt-neg-in82.1%
distribute-neg-in82.1%
metadata-eval82.1%
mul-1-neg82.1%
mul-1-neg82.1%
unsub-neg82.1%
Simplified82.1%
if -4.99999999999999989e37 < y < -1.2499999999999999e-8 or -9.5000000000000006e-55 < y < 7.99999999999999952e39Initial program 99.9%
Taylor expanded in z around inf 76.1%
+-commutative76.1%
Simplified76.1%
Final simplification78.9%
(FPCore (x y z)
:precision binary64
(if (<= y -2.8e+47)
(- z)
(if (<= y -3.9e-10)
y
(if (or (<= y -2.1e-54) (not (<= y 1.55e+56))) (- z) x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.8e+47) {
tmp = -z;
} else if (y <= -3.9e-10) {
tmp = y;
} else if ((y <= -2.1e-54) || !(y <= 1.55e+56)) {
tmp = -z;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-2.8d+47)) then
tmp = -z
else if (y <= (-3.9d-10)) then
tmp = y
else if ((y <= (-2.1d-54)) .or. (.not. (y <= 1.55d+56))) then
tmp = -z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.8e+47) {
tmp = -z;
} else if (y <= -3.9e-10) {
tmp = y;
} else if ((y <= -2.1e-54) || !(y <= 1.55e+56)) {
tmp = -z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.8e+47: tmp = -z elif y <= -3.9e-10: tmp = y elif (y <= -2.1e-54) or not (y <= 1.55e+56): tmp = -z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.8e+47) tmp = Float64(-z); elseif (y <= -3.9e-10) tmp = y; elseif ((y <= -2.1e-54) || !(y <= 1.55e+56)) tmp = Float64(-z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.8e+47) tmp = -z; elseif (y <= -3.9e-10) tmp = y; elseif ((y <= -2.1e-54) || ~((y <= 1.55e+56))) tmp = -z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.8e+47], (-z), If[LessEqual[y, -3.9e-10], y, If[Or[LessEqual[y, -2.1e-54], N[Not[LessEqual[y, 1.55e+56]], $MachinePrecision]], (-z), x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{+47}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq -3.9 \cdot 10^{-10}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq -2.1 \cdot 10^{-54} \lor \neg \left(y \leq 1.55 \cdot 10^{+56}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.79999999999999988e47 or -3.9e-10 < y < -2.1e-54 or 1.55000000000000002e56 < y Initial program 78.7%
Taylor expanded in y around inf 66.1%
neg-mul-166.1%
Simplified66.1%
if -2.79999999999999988e47 < y < -3.9e-10Initial program 100.0%
Taylor expanded in z around inf 80.8%
+-commutative80.8%
Simplified80.8%
Taylor expanded in y around inf 52.0%
if -2.1e-54 < y < 1.55000000000000002e56Initial program 99.9%
Taylor expanded in y around 0 58.8%
Final simplification61.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -3200.0) (not (<= z 2500000000.0))) (+ x y) (- (- z) (/ (* x z) y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3200.0) || !(z <= 2500000000.0)) {
tmp = x + y;
} else {
tmp = -z - ((x * z) / y);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-3200.0d0)) .or. (.not. (z <= 2500000000.0d0))) then
tmp = x + y
else
tmp = -z - ((x * z) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -3200.0) || !(z <= 2500000000.0)) {
tmp = x + y;
} else {
tmp = -z - ((x * z) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3200.0) or not (z <= 2500000000.0): tmp = x + y else: tmp = -z - ((x * z) / y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3200.0) || !(z <= 2500000000.0)) tmp = Float64(x + y); else tmp = Float64(Float64(-z) - Float64(Float64(x * z) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3200.0) || ~((z <= 2500000000.0))) tmp = x + y; else tmp = -z - ((x * z) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3200.0], N[Not[LessEqual[z, 2500000000.0]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[((-z) - N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3200 \lor \neg \left(z \leq 2500000000\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\left(-z\right) - \frac{x \cdot z}{y}\\
\end{array}
\end{array}
if z < -3200 or 2.5e9 < z Initial program 100.0%
Taylor expanded in z around inf 75.3%
+-commutative75.3%
Simplified75.3%
if -3200 < z < 2.5e9Initial program 81.9%
Taylor expanded in y around inf 58.6%
neg-mul-158.6%
distribute-neg-frac258.6%
Simplified58.6%
Taylor expanded in x around 0 75.3%
mul-1-neg75.3%
unsub-neg75.3%
mul-1-neg75.3%
associate-/l*72.6%
Simplified72.6%
Taylor expanded in x around 0 75.3%
Final simplification75.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -8.8e+91) (not (<= y 1.45e+82))) (- z) (+ x y)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -8.8e+91) || !(y <= 1.45e+82)) {
tmp = -z;
} else {
tmp = x + y;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-8.8d+91)) .or. (.not. (y <= 1.45d+82))) then
tmp = -z
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -8.8e+91) || !(y <= 1.45e+82)) {
tmp = -z;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -8.8e+91) or not (y <= 1.45e+82): tmp = -z else: tmp = x + y return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -8.8e+91) || !(y <= 1.45e+82)) tmp = Float64(-z); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -8.8e+91) || ~((y <= 1.45e+82))) tmp = -z; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -8.8e+91], N[Not[LessEqual[y, 1.45e+82]], $MachinePrecision]], (-z), N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.8 \cdot 10^{+91} \lor \neg \left(y \leq 1.45 \cdot 10^{+82}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if y < -8.79999999999999998e91 or 1.4500000000000001e82 < y Initial program 72.4%
Taylor expanded in y around inf 75.7%
neg-mul-175.7%
Simplified75.7%
if -8.79999999999999998e91 < y < 1.4500000000000001e82Initial program 99.4%
Taylor expanded in z around inf 67.2%
+-commutative67.2%
Simplified67.2%
Final simplification69.9%
(FPCore (x y z) :precision binary64 (if (<= x -9.2e-9) x (if (<= x 7e-123) y x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -9.2e-9) {
tmp = x;
} else if (x <= 7e-123) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-9.2d-9)) then
tmp = x
else if (x <= 7d-123) then
tmp = y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -9.2e-9) {
tmp = x;
} else if (x <= 7e-123) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -9.2e-9: tmp = x elif x <= 7e-123: tmp = y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -9.2e-9) tmp = x; elseif (x <= 7e-123) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -9.2e-9) tmp = x; elseif (x <= 7e-123) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -9.2e-9], x, If[LessEqual[x, 7e-123], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.2 \cdot 10^{-9}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-123}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -9.1999999999999997e-9 or 6.9999999999999997e-123 < x Initial program 90.3%
Taylor expanded in y around 0 46.4%
if -9.1999999999999997e-9 < x < 6.9999999999999997e-123Initial program 92.5%
Taylor expanded in z around inf 51.1%
+-commutative51.1%
Simplified51.1%
Taylor expanded in y around inf 39.5%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 91.1%
Taylor expanded in y around 0 35.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ (+ y x) (- y)) z)))
(if (< y -3.7429310762689856e+171)
t_0
(if (< y 3.5534662456086734e+168) (/ (+ x y) (- 1.0 (/ y z))) t_0))))
double code(double x, double y, double z) {
double t_0 = ((y + x) / -y) * z;
double tmp;
if (y < -3.7429310762689856e+171) {
tmp = t_0;
} else if (y < 3.5534662456086734e+168) {
tmp = (x + y) / (1.0 - (y / z));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((y + x) / -y) * z
if (y < (-3.7429310762689856d+171)) then
tmp = t_0
else if (y < 3.5534662456086734d+168) then
tmp = (x + y) / (1.0d0 - (y / z))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((y + x) / -y) * z;
double tmp;
if (y < -3.7429310762689856e+171) {
tmp = t_0;
} else if (y < 3.5534662456086734e+168) {
tmp = (x + y) / (1.0 - (y / z));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((y + x) / -y) * z tmp = 0 if y < -3.7429310762689856e+171: tmp = t_0 elif y < 3.5534662456086734e+168: tmp = (x + y) / (1.0 - (y / z)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(y + x) / Float64(-y)) * z) tmp = 0.0 if (y < -3.7429310762689856e+171) tmp = t_0; elseif (y < 3.5534662456086734e+168) tmp = Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((y + x) / -y) * z; tmp = 0.0; if (y < -3.7429310762689856e+171) tmp = t_0; elseif (y < 3.5534662456086734e+168) tmp = (x + y) / (1.0 - (y / z)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(y + x), $MachinePrecision] / (-y)), $MachinePrecision] * z), $MachinePrecision]}, If[Less[y, -3.7429310762689856e+171], t$95$0, If[Less[y, 3.5534662456086734e+168], N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y + x}{-y} \cdot z\\
\mathbf{if}\;y < -3.7429310762689856 \cdot 10^{+171}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y < 3.5534662456086734 \cdot 10^{+168}:\\
\;\;\;\;\frac{x + y}{1 - \frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
herbie shell --seed 2024110
(FPCore (x y z)
:name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"
:precision binary64
:alt
(if (< y -3.7429310762689856e+171) (* (/ (+ y x) (- y)) z) (if (< y 3.5534662456086734e+168) (/ (+ x y) (- 1.0 (/ y z))) (* (/ (+ y x) (- y)) z)))
(/ (+ x y) (- 1.0 (/ y z))))