
(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 11 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 -1e-271) (not (<= t_0 0.0))) t_0 (- (- z) (/ z (/ y x))))))
double code(double x, double y, double z) {
double t_0 = (x + y) / (1.0 - (y / z));
double tmp;
if ((t_0 <= -1e-271) || !(t_0 <= 0.0)) {
tmp = t_0;
} else {
tmp = -z - (z / (y / 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) :: t_0
real(8) :: tmp
t_0 = (x + y) / (1.0d0 - (y / z))
if ((t_0 <= (-1d-271)) .or. (.not. (t_0 <= 0.0d0))) then
tmp = t_0
else
tmp = -z - (z / (y / x))
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 <= -1e-271) || !(t_0 <= 0.0)) {
tmp = t_0;
} else {
tmp = -z - (z / (y / x));
}
return tmp;
}
def code(x, y, z): t_0 = (x + y) / (1.0 - (y / z)) tmp = 0 if (t_0 <= -1e-271) or not (t_0 <= 0.0): tmp = t_0 else: tmp = -z - (z / (y / x)) 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 <= -1e-271) || !(t_0 <= 0.0)) tmp = t_0; else tmp = Float64(Float64(-z) - Float64(z / Float64(y / x))); 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 <= -1e-271) || ~((t_0 <= 0.0))) tmp = t_0; else tmp = -z - (z / (y / x)); 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, -1e-271], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], t$95$0, N[((-z) - N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + y}{1 - \frac{y}{z}}\\
\mathbf{if}\;t_0 \leq -1 \cdot 10^{-271} \lor \neg \left(t_0 \leq 0\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left(-z\right) - \frac{z}{\frac{y}{x}}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) < -9.99999999999999963e-272 or 0.0 < (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) Initial program 99.9%
if -9.99999999999999963e-272 < (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) < 0.0Initial program 9.1%
Taylor expanded in z around 0 96.8%
associate-*r/96.8%
+-commutative96.8%
*-commutative96.8%
associate-*r*96.8%
mul-1-neg96.8%
+-commutative96.8%
Simplified96.8%
Taylor expanded in y around 0 100.0%
mul-1-neg100.0%
unsub-neg100.0%
mul-1-neg100.0%
associate-/l*100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (+ x y) (+ 1.0 (/ y z)))) (t_1 (- (- z) (/ z (/ y x)))))
(if (<= z -8e+128)
t_0
(if (<= z -2e+78)
(- (- z) (* z (/ x y)))
(if (<= z -25000000000000.0)
t_0
(if (<= z -4e-294)
t_1
(if (<= z 9.4e-294)
(/ x (- 1.0 (/ y z)))
(if (<= z 5.5e-31) t_1 t_0))))))))
double code(double x, double y, double z) {
double t_0 = (x + y) * (1.0 + (y / z));
double t_1 = -z - (z / (y / x));
double tmp;
if (z <= -8e+128) {
tmp = t_0;
} else if (z <= -2e+78) {
tmp = -z - (z * (x / y));
} else if (z <= -25000000000000.0) {
tmp = t_0;
} else if (z <= -4e-294) {
tmp = t_1;
} else if (z <= 9.4e-294) {
tmp = x / (1.0 - (y / z));
} else if (z <= 5.5e-31) {
tmp = t_1;
} 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) :: tmp
t_0 = (x + y) * (1.0d0 + (y / z))
t_1 = -z - (z / (y / x))
if (z <= (-8d+128)) then
tmp = t_0
else if (z <= (-2d+78)) then
tmp = -z - (z * (x / y))
else if (z <= (-25000000000000.0d0)) then
tmp = t_0
else if (z <= (-4d-294)) then
tmp = t_1
else if (z <= 9.4d-294) then
tmp = x / (1.0d0 - (y / z))
else if (z <= 5.5d-31) then
tmp = t_1
else
tmp = t_0
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 t_1 = -z - (z / (y / x));
double tmp;
if (z <= -8e+128) {
tmp = t_0;
} else if (z <= -2e+78) {
tmp = -z - (z * (x / y));
} else if (z <= -25000000000000.0) {
tmp = t_0;
} else if (z <= -4e-294) {
tmp = t_1;
} else if (z <= 9.4e-294) {
tmp = x / (1.0 - (y / z));
} else if (z <= 5.5e-31) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (x + y) * (1.0 + (y / z)) t_1 = -z - (z / (y / x)) tmp = 0 if z <= -8e+128: tmp = t_0 elif z <= -2e+78: tmp = -z - (z * (x / y)) elif z <= -25000000000000.0: tmp = t_0 elif z <= -4e-294: tmp = t_1 elif z <= 9.4e-294: tmp = x / (1.0 - (y / z)) elif z <= 5.5e-31: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(x + y) * Float64(1.0 + Float64(y / z))) t_1 = Float64(Float64(-z) - Float64(z / Float64(y / x))) tmp = 0.0 if (z <= -8e+128) tmp = t_0; elseif (z <= -2e+78) tmp = Float64(Float64(-z) - Float64(z * Float64(x / y))); elseif (z <= -25000000000000.0) tmp = t_0; elseif (z <= -4e-294) tmp = t_1; elseif (z <= 9.4e-294) tmp = Float64(x / Float64(1.0 - Float64(y / z))); elseif (z <= 5.5e-31) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + y) * (1.0 + (y / z)); t_1 = -z - (z / (y / x)); tmp = 0.0; if (z <= -8e+128) tmp = t_0; elseif (z <= -2e+78) tmp = -z - (z * (x / y)); elseif (z <= -25000000000000.0) tmp = t_0; elseif (z <= -4e-294) tmp = t_1; elseif (z <= 9.4e-294) tmp = x / (1.0 - (y / z)); elseif (z <= 5.5e-31) tmp = t_1; else tmp = t_0; 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]}, Block[{t$95$1 = N[((-z) - N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8e+128], t$95$0, If[LessEqual[z, -2e+78], N[((-z) - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -25000000000000.0], t$95$0, If[LessEqual[z, -4e-294], t$95$1, If[LessEqual[z, 9.4e-294], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.5e-31], t$95$1, t$95$0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + y\right) \cdot \left(1 + \frac{y}{z}\right)\\
t_1 := \left(-z\right) - \frac{z}{\frac{y}{x}}\\
\mathbf{if}\;z \leq -8 \cdot 10^{+128}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -2 \cdot 10^{+78}:\\
\;\;\;\;\left(-z\right) - z \cdot \frac{x}{y}\\
\mathbf{elif}\;z \leq -25000000000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -4 \cdot 10^{-294}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 9.4 \cdot 10^{-294}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{-31}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -8.0000000000000006e128 or -2.00000000000000002e78 < z < -2.5e13 or 5.49999999999999958e-31 < z Initial program 99.9%
Taylor expanded in z around inf 72.3%
associate-/l*82.3%
+-commutative82.3%
associate-/r/82.3%
+-commutative82.3%
*-lft-identity82.3%
distribute-rgt-in82.3%
+-commutative82.3%
+-commutative82.3%
Simplified82.3%
if -8.0000000000000006e128 < z < -2.00000000000000002e78Initial program 99.7%
Taylor expanded in z around 0 68.2%
associate-*r/68.2%
+-commutative68.2%
*-commutative68.2%
associate-*r*68.2%
mul-1-neg68.2%
+-commutative68.2%
Simplified68.2%
Taylor expanded in y around 0 67.5%
mul-1-neg67.5%
unsub-neg67.5%
mul-1-neg67.5%
associate-/l*100.0%
Simplified100.0%
clear-num100.0%
associate-/r/100.0%
clear-num100.0%
Applied egg-rr100.0%
if -2.5e13 < z < -4.00000000000000007e-294 or 9.4000000000000003e-294 < z < 5.49999999999999958e-31Initial program 74.9%
Taylor expanded in z around 0 72.1%
associate-*r/72.1%
+-commutative72.1%
*-commutative72.1%
associate-*r*72.1%
mul-1-neg72.1%
+-commutative72.1%
Simplified72.1%
Taylor expanded in y around 0 75.4%
mul-1-neg75.4%
unsub-neg75.4%
mul-1-neg75.4%
associate-/l*75.4%
Simplified75.4%
if -4.00000000000000007e-294 < z < 9.4000000000000003e-294Initial program 90.2%
Taylor expanded in x around inf 90.2%
Final simplification79.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (/ y z))))
(if (<= y -2.9e+104)
(- z)
(if (<= y -1.2e-40)
(+ x y)
(if (<= y -5.4e-71)
(/ y t_0)
(if (<= y 4.3e-162)
(/ x t_0)
(if (<= y 7.3e-62)
(+ x y)
(if (<= y 7.5e+154) (* (+ x y) (- (/ z y))) (- z)))))))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (y / z);
double tmp;
if (y <= -2.9e+104) {
tmp = -z;
} else if (y <= -1.2e-40) {
tmp = x + y;
} else if (y <= -5.4e-71) {
tmp = y / t_0;
} else if (y <= 4.3e-162) {
tmp = x / t_0;
} else if (y <= 7.3e-62) {
tmp = x + y;
} else if (y <= 7.5e+154) {
tmp = (x + y) * -(z / y);
} else {
tmp = -z;
}
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 = 1.0d0 - (y / z)
if (y <= (-2.9d+104)) then
tmp = -z
else if (y <= (-1.2d-40)) then
tmp = x + y
else if (y <= (-5.4d-71)) then
tmp = y / t_0
else if (y <= 4.3d-162) then
tmp = x / t_0
else if (y <= 7.3d-62) then
tmp = x + y
else if (y <= 7.5d+154) then
tmp = (x + y) * -(z / y)
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 - (y / z);
double tmp;
if (y <= -2.9e+104) {
tmp = -z;
} else if (y <= -1.2e-40) {
tmp = x + y;
} else if (y <= -5.4e-71) {
tmp = y / t_0;
} else if (y <= 4.3e-162) {
tmp = x / t_0;
} else if (y <= 7.3e-62) {
tmp = x + y;
} else if (y <= 7.5e+154) {
tmp = (x + y) * -(z / y);
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (y / z) tmp = 0 if y <= -2.9e+104: tmp = -z elif y <= -1.2e-40: tmp = x + y elif y <= -5.4e-71: tmp = y / t_0 elif y <= 4.3e-162: tmp = x / t_0 elif y <= 7.3e-62: tmp = x + y elif y <= 7.5e+154: tmp = (x + y) * -(z / y) else: tmp = -z return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(y / z)) tmp = 0.0 if (y <= -2.9e+104) tmp = Float64(-z); elseif (y <= -1.2e-40) tmp = Float64(x + y); elseif (y <= -5.4e-71) tmp = Float64(y / t_0); elseif (y <= 4.3e-162) tmp = Float64(x / t_0); elseif (y <= 7.3e-62) tmp = Float64(x + y); elseif (y <= 7.5e+154) tmp = Float64(Float64(x + y) * Float64(-Float64(z / y))); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - (y / z); tmp = 0.0; if (y <= -2.9e+104) tmp = -z; elseif (y <= -1.2e-40) tmp = x + y; elseif (y <= -5.4e-71) tmp = y / t_0; elseif (y <= 4.3e-162) tmp = x / t_0; elseif (y <= 7.3e-62) tmp = x + y; elseif (y <= 7.5e+154) tmp = (x + y) * -(z / y); else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.9e+104], (-z), If[LessEqual[y, -1.2e-40], N[(x + y), $MachinePrecision], If[LessEqual[y, -5.4e-71], N[(y / t$95$0), $MachinePrecision], If[LessEqual[y, 4.3e-162], N[(x / t$95$0), $MachinePrecision], If[LessEqual[y, 7.3e-62], N[(x + y), $MachinePrecision], If[LessEqual[y, 7.5e+154], N[(N[(x + y), $MachinePrecision] * (-N[(z / y), $MachinePrecision])), $MachinePrecision], (-z)]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{y}{z}\\
\mathbf{if}\;y \leq -2.9 \cdot 10^{+104}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq -1.2 \cdot 10^{-40}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq -5.4 \cdot 10^{-71}:\\
\;\;\;\;\frac{y}{t_0}\\
\mathbf{elif}\;y \leq 4.3 \cdot 10^{-162}:\\
\;\;\;\;\frac{x}{t_0}\\
\mathbf{elif}\;y \leq 7.3 \cdot 10^{-62}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+154}:\\
\;\;\;\;\left(x + y\right) \cdot \left(-\frac{z}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -2.8999999999999998e104 or 7.5000000000000004e154 < y Initial program 64.0%
Taylor expanded in y around inf 71.5%
mul-1-neg71.5%
Simplified71.5%
if -2.8999999999999998e104 < y < -1.19999999999999996e-40 or 4.29999999999999996e-162 < y < 7.2999999999999998e-62Initial program 97.9%
Taylor expanded in z around inf 68.8%
if -1.19999999999999996e-40 < y < -5.4000000000000003e-71Initial program 99.8%
Taylor expanded in x around 0 70.3%
if -5.4000000000000003e-71 < y < 4.29999999999999996e-162Initial program 99.9%
Taylor expanded in x around inf 86.9%
if 7.2999999999999998e-62 < y < 7.5000000000000004e154Initial program 94.7%
clear-num94.2%
associate-/r/94.5%
Applied egg-rr94.5%
Taylor expanded in y around inf 64.8%
associate-*r/64.8%
mul-1-neg64.8%
Simplified64.8%
Final simplification75.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (- z) (* z (/ x y)))))
(if (<= z -8e+128)
(+ x y)
(if (<= z -9e+80)
t_0
(if (<= z -1380000000000.0)
(+ x y)
(if (<= z -8.8e-294)
t_0
(if (<= z 2.8e-294)
(/ x (- 1.0 (/ y z)))
(if (<= z 5.1e-30) t_0 (+ x y)))))))))
double code(double x, double y, double z) {
double t_0 = -z - (z * (x / y));
double tmp;
if (z <= -8e+128) {
tmp = x + y;
} else if (z <= -9e+80) {
tmp = t_0;
} else if (z <= -1380000000000.0) {
tmp = x + y;
} else if (z <= -8.8e-294) {
tmp = t_0;
} else if (z <= 2.8e-294) {
tmp = x / (1.0 - (y / z));
} else if (z <= 5.1e-30) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = -z - (z * (x / y))
if (z <= (-8d+128)) then
tmp = x + y
else if (z <= (-9d+80)) then
tmp = t_0
else if (z <= (-1380000000000.0d0)) then
tmp = x + y
else if (z <= (-8.8d-294)) then
tmp = t_0
else if (z <= 2.8d-294) then
tmp = x / (1.0d0 - (y / z))
else if (z <= 5.1d-30) then
tmp = t_0
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -z - (z * (x / y));
double tmp;
if (z <= -8e+128) {
tmp = x + y;
} else if (z <= -9e+80) {
tmp = t_0;
} else if (z <= -1380000000000.0) {
tmp = x + y;
} else if (z <= -8.8e-294) {
tmp = t_0;
} else if (z <= 2.8e-294) {
tmp = x / (1.0 - (y / z));
} else if (z <= 5.1e-30) {
tmp = t_0;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): t_0 = -z - (z * (x / y)) tmp = 0 if z <= -8e+128: tmp = x + y elif z <= -9e+80: tmp = t_0 elif z <= -1380000000000.0: tmp = x + y elif z <= -8.8e-294: tmp = t_0 elif z <= 2.8e-294: tmp = x / (1.0 - (y / z)) elif z <= 5.1e-30: tmp = t_0 else: tmp = x + y return tmp
function code(x, y, z) t_0 = Float64(Float64(-z) - Float64(z * Float64(x / y))) tmp = 0.0 if (z <= -8e+128) tmp = Float64(x + y); elseif (z <= -9e+80) tmp = t_0; elseif (z <= -1380000000000.0) tmp = Float64(x + y); elseif (z <= -8.8e-294) tmp = t_0; elseif (z <= 2.8e-294) tmp = Float64(x / Float64(1.0 - Float64(y / z))); elseif (z <= 5.1e-30) tmp = t_0; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z) t_0 = -z - (z * (x / y)); tmp = 0.0; if (z <= -8e+128) tmp = x + y; elseif (z <= -9e+80) tmp = t_0; elseif (z <= -1380000000000.0) tmp = x + y; elseif (z <= -8.8e-294) tmp = t_0; elseif (z <= 2.8e-294) tmp = x / (1.0 - (y / z)); elseif (z <= 5.1e-30) tmp = t_0; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[((-z) - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8e+128], N[(x + y), $MachinePrecision], If[LessEqual[z, -9e+80], t$95$0, If[LessEqual[z, -1380000000000.0], N[(x + y), $MachinePrecision], If[LessEqual[z, -8.8e-294], t$95$0, If[LessEqual[z, 2.8e-294], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.1e-30], t$95$0, N[(x + y), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-z\right) - z \cdot \frac{x}{y}\\
\mathbf{if}\;z \leq -8 \cdot 10^{+128}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq -9 \cdot 10^{+80}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1380000000000:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq -8.8 \cdot 10^{-294}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{-294}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\
\mathbf{elif}\;z \leq 5.1 \cdot 10^{-30}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -8.0000000000000006e128 or -9.00000000000000013e80 < z < -1.38e12 or 5.09999999999999972e-30 < z Initial program 99.9%
Taylor expanded in z around inf 82.0%
if -8.0000000000000006e128 < z < -9.00000000000000013e80 or -1.38e12 < z < -8.8e-294 or 2.79999999999999991e-294 < z < 5.09999999999999972e-30Initial program 76.1%
Taylor expanded in z around 0 71.2%
associate-*r/71.2%
+-commutative71.2%
*-commutative71.2%
associate-*r*71.2%
mul-1-neg71.2%
+-commutative71.2%
Simplified71.2%
Taylor expanded in y around 0 74.3%
mul-1-neg74.3%
unsub-neg74.3%
mul-1-neg74.3%
associate-/l*76.6%
Simplified76.6%
clear-num76.4%
associate-/r/76.5%
clear-num76.5%
Applied egg-rr76.5%
if -8.8e-294 < z < 2.79999999999999991e-294Initial program 90.0%
Taylor expanded in x around inf 90.0%
Final simplification79.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (- z) (/ z (/ y x)))))
(if (<= z -8e+128)
(+ x y)
(if (<= z -3.7e+79)
(- (- z) (* z (/ x y)))
(if (<= z -15200000.0)
(+ x y)
(if (<= z -4e-294)
t_0
(if (<= z 9.4e-294)
(/ x (- 1.0 (/ y z)))
(if (<= z 2e-32) t_0 (+ x y)))))))))
double code(double x, double y, double z) {
double t_0 = -z - (z / (y / x));
double tmp;
if (z <= -8e+128) {
tmp = x + y;
} else if (z <= -3.7e+79) {
tmp = -z - (z * (x / y));
} else if (z <= -15200000.0) {
tmp = x + y;
} else if (z <= -4e-294) {
tmp = t_0;
} else if (z <= 9.4e-294) {
tmp = x / (1.0 - (y / z));
} else if (z <= 2e-32) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = -z - (z / (y / x))
if (z <= (-8d+128)) then
tmp = x + y
else if (z <= (-3.7d+79)) then
tmp = -z - (z * (x / y))
else if (z <= (-15200000.0d0)) then
tmp = x + y
else if (z <= (-4d-294)) then
tmp = t_0
else if (z <= 9.4d-294) then
tmp = x / (1.0d0 - (y / z))
else if (z <= 2d-32) then
tmp = t_0
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -z - (z / (y / x));
double tmp;
if (z <= -8e+128) {
tmp = x + y;
} else if (z <= -3.7e+79) {
tmp = -z - (z * (x / y));
} else if (z <= -15200000.0) {
tmp = x + y;
} else if (z <= -4e-294) {
tmp = t_0;
} else if (z <= 9.4e-294) {
tmp = x / (1.0 - (y / z));
} else if (z <= 2e-32) {
tmp = t_0;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): t_0 = -z - (z / (y / x)) tmp = 0 if z <= -8e+128: tmp = x + y elif z <= -3.7e+79: tmp = -z - (z * (x / y)) elif z <= -15200000.0: tmp = x + y elif z <= -4e-294: tmp = t_0 elif z <= 9.4e-294: tmp = x / (1.0 - (y / z)) elif z <= 2e-32: tmp = t_0 else: tmp = x + y return tmp
function code(x, y, z) t_0 = Float64(Float64(-z) - Float64(z / Float64(y / x))) tmp = 0.0 if (z <= -8e+128) tmp = Float64(x + y); elseif (z <= -3.7e+79) tmp = Float64(Float64(-z) - Float64(z * Float64(x / y))); elseif (z <= -15200000.0) tmp = Float64(x + y); elseif (z <= -4e-294) tmp = t_0; elseif (z <= 9.4e-294) tmp = Float64(x / Float64(1.0 - Float64(y / z))); elseif (z <= 2e-32) tmp = t_0; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z) t_0 = -z - (z / (y / x)); tmp = 0.0; if (z <= -8e+128) tmp = x + y; elseif (z <= -3.7e+79) tmp = -z - (z * (x / y)); elseif (z <= -15200000.0) tmp = x + y; elseif (z <= -4e-294) tmp = t_0; elseif (z <= 9.4e-294) tmp = x / (1.0 - (y / z)); elseif (z <= 2e-32) tmp = t_0; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[((-z) - N[(z / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8e+128], N[(x + y), $MachinePrecision], If[LessEqual[z, -3.7e+79], N[((-z) - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -15200000.0], N[(x + y), $MachinePrecision], If[LessEqual[z, -4e-294], t$95$0, If[LessEqual[z, 9.4e-294], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2e-32], t$95$0, N[(x + y), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-z\right) - \frac{z}{\frac{y}{x}}\\
\mathbf{if}\;z \leq -8 \cdot 10^{+128}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq -3.7 \cdot 10^{+79}:\\
\;\;\;\;\left(-z\right) - z \cdot \frac{x}{y}\\
\mathbf{elif}\;z \leq -15200000:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq -4 \cdot 10^{-294}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 9.4 \cdot 10^{-294}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-32}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -8.0000000000000006e128 or -3.70000000000000009e79 < z < -1.52e7 or 2.00000000000000011e-32 < z Initial program 99.9%
Taylor expanded in z around inf 82.0%
if -8.0000000000000006e128 < z < -3.70000000000000009e79Initial program 99.7%
Taylor expanded in z around 0 68.2%
associate-*r/68.2%
+-commutative68.2%
*-commutative68.2%
associate-*r*68.2%
mul-1-neg68.2%
+-commutative68.2%
Simplified68.2%
Taylor expanded in y around 0 67.5%
mul-1-neg67.5%
unsub-neg67.5%
mul-1-neg67.5%
associate-/l*100.0%
Simplified100.0%
clear-num100.0%
associate-/r/100.0%
clear-num100.0%
Applied egg-rr100.0%
if -1.52e7 < z < -4.00000000000000007e-294 or 9.4000000000000003e-294 < z < 2.00000000000000011e-32Initial program 74.9%
Taylor expanded in z around 0 72.1%
associate-*r/72.1%
+-commutative72.1%
*-commutative72.1%
associate-*r*72.1%
mul-1-neg72.1%
+-commutative72.1%
Simplified72.1%
Taylor expanded in y around 0 75.4%
mul-1-neg75.4%
unsub-neg75.4%
mul-1-neg75.4%
associate-/l*75.4%
Simplified75.4%
if -4.00000000000000007e-294 < z < 9.4000000000000003e-294Initial program 90.2%
Taylor expanded in x around inf 90.2%
Final simplification79.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (/ y z))) (t_1 (/ x t_0)))
(if (<= y -6e+104)
(- z)
(if (<= y -2.15e-40)
(+ x y)
(if (<= y -5.8e-69)
(/ y t_0)
(if (<= y 1.15e-160)
t_1
(if (<= y 9.2e-43) (+ x y) (if (<= y 2.95e+26) t_1 (- z)))))))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (y / z);
double t_1 = x / t_0;
double tmp;
if (y <= -6e+104) {
tmp = -z;
} else if (y <= -2.15e-40) {
tmp = x + y;
} else if (y <= -5.8e-69) {
tmp = y / t_0;
} else if (y <= 1.15e-160) {
tmp = t_1;
} else if (y <= 9.2e-43) {
tmp = x + y;
} else if (y <= 2.95e+26) {
tmp = t_1;
} else {
tmp = -z;
}
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) :: tmp
t_0 = 1.0d0 - (y / z)
t_1 = x / t_0
if (y <= (-6d+104)) then
tmp = -z
else if (y <= (-2.15d-40)) then
tmp = x + y
else if (y <= (-5.8d-69)) then
tmp = y / t_0
else if (y <= 1.15d-160) then
tmp = t_1
else if (y <= 9.2d-43) then
tmp = x + y
else if (y <= 2.95d+26) then
tmp = t_1
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 - (y / z);
double t_1 = x / t_0;
double tmp;
if (y <= -6e+104) {
tmp = -z;
} else if (y <= -2.15e-40) {
tmp = x + y;
} else if (y <= -5.8e-69) {
tmp = y / t_0;
} else if (y <= 1.15e-160) {
tmp = t_1;
} else if (y <= 9.2e-43) {
tmp = x + y;
} else if (y <= 2.95e+26) {
tmp = t_1;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (y / z) t_1 = x / t_0 tmp = 0 if y <= -6e+104: tmp = -z elif y <= -2.15e-40: tmp = x + y elif y <= -5.8e-69: tmp = y / t_0 elif y <= 1.15e-160: tmp = t_1 elif y <= 9.2e-43: tmp = x + y elif y <= 2.95e+26: tmp = t_1 else: tmp = -z return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(y / z)) t_1 = Float64(x / t_0) tmp = 0.0 if (y <= -6e+104) tmp = Float64(-z); elseif (y <= -2.15e-40) tmp = Float64(x + y); elseif (y <= -5.8e-69) tmp = Float64(y / t_0); elseif (y <= 1.15e-160) tmp = t_1; elseif (y <= 9.2e-43) tmp = Float64(x + y); elseif (y <= 2.95e+26) tmp = t_1; else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - (y / z); t_1 = x / t_0; tmp = 0.0; if (y <= -6e+104) tmp = -z; elseif (y <= -2.15e-40) tmp = x + y; elseif (y <= -5.8e-69) tmp = y / t_0; elseif (y <= 1.15e-160) tmp = t_1; elseif (y <= 9.2e-43) tmp = x + y; elseif (y <= 2.95e+26) tmp = t_1; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / t$95$0), $MachinePrecision]}, If[LessEqual[y, -6e+104], (-z), If[LessEqual[y, -2.15e-40], N[(x + y), $MachinePrecision], If[LessEqual[y, -5.8e-69], N[(y / t$95$0), $MachinePrecision], If[LessEqual[y, 1.15e-160], t$95$1, If[LessEqual[y, 9.2e-43], N[(x + y), $MachinePrecision], If[LessEqual[y, 2.95e+26], t$95$1, (-z)]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{y}{z}\\
t_1 := \frac{x}{t_0}\\
\mathbf{if}\;y \leq -6 \cdot 10^{+104}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq -2.15 \cdot 10^{-40}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-69}:\\
\;\;\;\;\frac{y}{t_0}\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-160}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 9.2 \cdot 10^{-43}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 2.95 \cdot 10^{+26}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -5.99999999999999937e104 or 2.95000000000000015e26 < y Initial program 69.9%
Taylor expanded in y around inf 66.7%
mul-1-neg66.7%
Simplified66.7%
if -5.99999999999999937e104 < y < -2.1500000000000001e-40 or 1.14999999999999992e-160 < y < 9.1999999999999995e-43Initial program 98.0%
Taylor expanded in z around inf 67.0%
if -2.1500000000000001e-40 < y < -5.7999999999999997e-69Initial program 99.8%
Taylor expanded in x around 0 70.3%
if -5.7999999999999997e-69 < y < 1.14999999999999992e-160 or 9.1999999999999995e-43 < y < 2.95000000000000015e26Initial program 99.9%
Taylor expanded in x around inf 84.1%
Final simplification73.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ x (- 1.0 (/ y z)))))
(if (<= y -2.4e+104)
(- z)
(if (<= y -1.6e-205)
(+ x y)
(if (<= y 4.2e-161)
t_0
(if (<= y 8e-40)
(+ x y)
(if (<= y 7.2e+22)
t_0
(if (<= y 5.7e+72)
(- z)
(if (<= y 1.95e+120) (+ x y) (- z))))))))))
double code(double x, double y, double z) {
double t_0 = x / (1.0 - (y / z));
double tmp;
if (y <= -2.4e+104) {
tmp = -z;
} else if (y <= -1.6e-205) {
tmp = x + y;
} else if (y <= 4.2e-161) {
tmp = t_0;
} else if (y <= 8e-40) {
tmp = x + y;
} else if (y <= 7.2e+22) {
tmp = t_0;
} else if (y <= 5.7e+72) {
tmp = -z;
} else if (y <= 1.95e+120) {
tmp = x + y;
} else {
tmp = -z;
}
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 / (1.0d0 - (y / z))
if (y <= (-2.4d+104)) then
tmp = -z
else if (y <= (-1.6d-205)) then
tmp = x + y
else if (y <= 4.2d-161) then
tmp = t_0
else if (y <= 8d-40) then
tmp = x + y
else if (y <= 7.2d+22) then
tmp = t_0
else if (y <= 5.7d+72) then
tmp = -z
else if (y <= 1.95d+120) then
tmp = x + y
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x / (1.0 - (y / z));
double tmp;
if (y <= -2.4e+104) {
tmp = -z;
} else if (y <= -1.6e-205) {
tmp = x + y;
} else if (y <= 4.2e-161) {
tmp = t_0;
} else if (y <= 8e-40) {
tmp = x + y;
} else if (y <= 7.2e+22) {
tmp = t_0;
} else if (y <= 5.7e+72) {
tmp = -z;
} else if (y <= 1.95e+120) {
tmp = x + y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): t_0 = x / (1.0 - (y / z)) tmp = 0 if y <= -2.4e+104: tmp = -z elif y <= -1.6e-205: tmp = x + y elif y <= 4.2e-161: tmp = t_0 elif y <= 8e-40: tmp = x + y elif y <= 7.2e+22: tmp = t_0 elif y <= 5.7e+72: tmp = -z elif y <= 1.95e+120: tmp = x + y else: tmp = -z return tmp
function code(x, y, z) t_0 = Float64(x / Float64(1.0 - Float64(y / z))) tmp = 0.0 if (y <= -2.4e+104) tmp = Float64(-z); elseif (y <= -1.6e-205) tmp = Float64(x + y); elseif (y <= 4.2e-161) tmp = t_0; elseif (y <= 8e-40) tmp = Float64(x + y); elseif (y <= 7.2e+22) tmp = t_0; elseif (y <= 5.7e+72) tmp = Float64(-z); elseif (y <= 1.95e+120) tmp = Float64(x + y); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x / (1.0 - (y / z)); tmp = 0.0; if (y <= -2.4e+104) tmp = -z; elseif (y <= -1.6e-205) tmp = x + y; elseif (y <= 4.2e-161) tmp = t_0; elseif (y <= 8e-40) tmp = x + y; elseif (y <= 7.2e+22) tmp = t_0; elseif (y <= 5.7e+72) tmp = -z; elseif (y <= 1.95e+120) tmp = x + y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.4e+104], (-z), If[LessEqual[y, -1.6e-205], N[(x + y), $MachinePrecision], If[LessEqual[y, 4.2e-161], t$95$0, If[LessEqual[y, 8e-40], N[(x + y), $MachinePrecision], If[LessEqual[y, 7.2e+22], t$95$0, If[LessEqual[y, 5.7e+72], (-z), If[LessEqual[y, 1.95e+120], N[(x + y), $MachinePrecision], (-z)]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{1 - \frac{y}{z}}\\
\mathbf{if}\;y \leq -2.4 \cdot 10^{+104}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq -1.6 \cdot 10^{-205}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-161}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 8 \cdot 10^{-40}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{+22}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 5.7 \cdot 10^{+72}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{+120}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -2.4e104 or 7.2e22 < y < 5.6999999999999997e72 or 1.9499999999999999e120 < y Initial program 67.2%
Taylor expanded in y around inf 71.4%
mul-1-neg71.4%
Simplified71.4%
if -2.4e104 < y < -1.60000000000000005e-205 or 4.2000000000000001e-161 < y < 7.9999999999999994e-40 or 5.6999999999999997e72 < y < 1.9499999999999999e120Initial program 98.9%
Taylor expanded in z around inf 66.7%
if -1.60000000000000005e-205 < y < 4.2000000000000001e-161 or 7.9999999999999994e-40 < y < 7.2e22Initial program 99.9%
Taylor expanded in x around inf 90.1%
Final simplification75.1%
(FPCore (x y z)
:precision binary64
(if (<= y -7e+104)
(- z)
(if (or (<= y 2e+23) (and (not (<= y 3.9e+70)) (<= y 2e+138)))
(+ x y)
(- z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -7e+104) {
tmp = -z;
} else if ((y <= 2e+23) || (!(y <= 3.9e+70) && (y <= 2e+138))) {
tmp = x + y;
} else {
tmp = -z;
}
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 <= (-7d+104)) then
tmp = -z
else if ((y <= 2d+23) .or. (.not. (y <= 3.9d+70)) .and. (y <= 2d+138)) then
tmp = x + y
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -7e+104) {
tmp = -z;
} else if ((y <= 2e+23) || (!(y <= 3.9e+70) && (y <= 2e+138))) {
tmp = x + y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -7e+104: tmp = -z elif (y <= 2e+23) or (not (y <= 3.9e+70) and (y <= 2e+138)): tmp = x + y else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -7e+104) tmp = Float64(-z); elseif ((y <= 2e+23) || (!(y <= 3.9e+70) && (y <= 2e+138))) tmp = Float64(x + y); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -7e+104) tmp = -z; elseif ((y <= 2e+23) || (~((y <= 3.9e+70)) && (y <= 2e+138))) tmp = x + y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -7e+104], (-z), If[Or[LessEqual[y, 2e+23], And[N[Not[LessEqual[y, 3.9e+70]], $MachinePrecision], LessEqual[y, 2e+138]]], N[(x + y), $MachinePrecision], (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{+104}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+23} \lor \neg \left(y \leq 3.9 \cdot 10^{+70}\right) \land y \leq 2 \cdot 10^{+138}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -7.0000000000000003e104 or 1.9999999999999998e23 < y < 3.89999999999999975e70 or 2.0000000000000001e138 < y Initial program 67.2%
Taylor expanded in y around inf 71.4%
mul-1-neg71.4%
Simplified71.4%
if -7.0000000000000003e104 < y < 1.9999999999999998e23 or 3.89999999999999975e70 < y < 2.0000000000000001e138Initial program 99.3%
Taylor expanded in z around inf 71.1%
Final simplification71.2%
(FPCore (x y z) :precision binary64 (if (<= y -8.5e+45) (- z) (if (<= y 7.3e-62) x (- z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -8.5e+45) {
tmp = -z;
} else if (y <= 7.3e-62) {
tmp = x;
} else {
tmp = -z;
}
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.5d+45)) then
tmp = -z
else if (y <= 7.3d-62) then
tmp = x
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -8.5e+45) {
tmp = -z;
} else if (y <= 7.3e-62) {
tmp = x;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -8.5e+45: tmp = -z elif y <= 7.3e-62: tmp = x else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -8.5e+45) tmp = Float64(-z); elseif (y <= 7.3e-62) tmp = x; else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -8.5e+45) tmp = -z; elseif (y <= 7.3e-62) tmp = x; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -8.5e+45], (-z), If[LessEqual[y, 7.3e-62], x, (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{+45}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 7.3 \cdot 10^{-62}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -8.4999999999999996e45 or 7.2999999999999998e-62 < y Initial program 75.4%
Taylor expanded in y around inf 58.0%
mul-1-neg58.0%
Simplified58.0%
if -8.4999999999999996e45 < y < 7.2999999999999998e-62Initial program 99.9%
Taylor expanded in y around 0 59.8%
Final simplification59.0%
(FPCore (x y z) :precision binary64 (if (<= y -2.2e-79) y (if (<= y 2.5e-69) x y)))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.2e-79) {
tmp = y;
} else if (y <= 2.5e-69) {
tmp = x;
} else {
tmp = 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 <= (-2.2d-79)) then
tmp = y
else if (y <= 2.5d-69) then
tmp = x
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.2e-79) {
tmp = y;
} else if (y <= 2.5e-69) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.2e-79: tmp = y elif y <= 2.5e-69: tmp = x else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.2e-79) tmp = y; elseif (y <= 2.5e-69) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.2e-79) tmp = y; elseif (y <= 2.5e-69) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.2e-79], y, If[LessEqual[y, 2.5e-69], x, y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{-79}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{-69}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -2.1999999999999999e-79 or 2.50000000000000017e-69 < y Initial program 80.0%
Taylor expanded in x around 0 56.1%
Taylor expanded in y around 0 22.5%
if -2.1999999999999999e-79 < y < 2.50000000000000017e-69Initial program 99.9%
Taylor expanded in y around 0 69.1%
Final simplification41.6%
(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 88.2%
Taylor expanded in y around 0 35.0%
Final simplification35.0%
(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 2023200
(FPCore (x y z)
:name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"
:precision binary64
:herbie-target
(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))))