
(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 -5e-290) (not (<= t_0 0.0))) t_0 (- (/ (* x z) (- y)) z))))
double code(double x, double y, double z) {
double t_0 = (x + y) / (1.0 - (y / z));
double tmp;
if ((t_0 <= -5e-290) || !(t_0 <= 0.0)) {
tmp = t_0;
} else {
tmp = ((x * z) / -y) - 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 + y) / (1.0d0 - (y / z))
if ((t_0 <= (-5d-290)) .or. (.not. (t_0 <= 0.0d0))) then
tmp = t_0
else
tmp = ((x * z) / -y) - z
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 <= -5e-290) || !(t_0 <= 0.0)) {
tmp = t_0;
} else {
tmp = ((x * z) / -y) - z;
}
return tmp;
}
def code(x, y, z): t_0 = (x + y) / (1.0 - (y / z)) tmp = 0 if (t_0 <= -5e-290) or not (t_0 <= 0.0): tmp = t_0 else: tmp = ((x * z) / -y) - z 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 <= -5e-290) || !(t_0 <= 0.0)) tmp = t_0; else tmp = Float64(Float64(Float64(x * z) / Float64(-y)) - z); 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 <= -5e-290) || ~((t_0 <= 0.0))) tmp = t_0; else tmp = ((x * z) / -y) - z; 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, -5e-290], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], t$95$0, N[(N[(N[(x * z), $MachinePrecision] / (-y)), $MachinePrecision] - z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + y}{1 - \frac{y}{z}}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-290} \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot z}{-y} - z\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -5.0000000000000001e-290 or 0.0 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) Initial program 99.9%
if -5.0000000000000001e-290 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 0.0Initial program 9.3%
Taylor expanded in z around 0 99.8%
mul-1-neg99.8%
associate-/l*99.9%
distribute-rgt-neg-in99.9%
distribute-neg-frac299.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
mul-1-neg100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (<= z -3.6e+41)
(+ x y)
(if (<= z -2.25e-21)
(/ z (+ (/ z y) -1.0))
(if (<= z 7.2e+26) (/ (* z (+ x y)) (- y)) (+ x y)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.6e+41) {
tmp = x + y;
} else if (z <= -2.25e-21) {
tmp = z / ((z / y) + -1.0);
} else if (z <= 7.2e+26) {
tmp = (z * (x + y)) / -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 (z <= (-3.6d+41)) then
tmp = x + y
else if (z <= (-2.25d-21)) then
tmp = z / ((z / y) + (-1.0d0))
else if (z <= 7.2d+26) then
tmp = (z * (x + y)) / -y
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -3.6e+41) {
tmp = x + y;
} else if (z <= -2.25e-21) {
tmp = z / ((z / y) + -1.0);
} else if (z <= 7.2e+26) {
tmp = (z * (x + y)) / -y;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.6e+41: tmp = x + y elif z <= -2.25e-21: tmp = z / ((z / y) + -1.0) elif z <= 7.2e+26: tmp = (z * (x + y)) / -y else: tmp = x + y return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.6e+41) tmp = Float64(x + y); elseif (z <= -2.25e-21) tmp = Float64(z / Float64(Float64(z / y) + -1.0)); elseif (z <= 7.2e+26) tmp = Float64(Float64(z * Float64(x + y)) / Float64(-y)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3.6e+41) tmp = x + y; elseif (z <= -2.25e-21) tmp = z / ((z / y) + -1.0); elseif (z <= 7.2e+26) tmp = (z * (x + y)) / -y; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.6e+41], N[(x + y), $MachinePrecision], If[LessEqual[z, -2.25e-21], N[(z / N[(N[(z / y), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.2e+26], N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] / (-y)), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{+41}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq -2.25 \cdot 10^{-21}:\\
\;\;\;\;\frac{z}{\frac{z}{y} + -1}\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{+26}:\\
\;\;\;\;\frac{z \cdot \left(x + y\right)}{-y}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -3.60000000000000025e41 or 7.20000000000000048e26 < z Initial program 99.9%
Taylor expanded in z around inf 81.6%
+-commutative81.6%
Simplified81.6%
if -3.60000000000000025e41 < z < -2.24999999999999984e-21Initial program 100.0%
clear-num99.5%
inv-pow99.5%
Applied egg-rr99.5%
Taylor expanded in z around 0 95.8%
+-commutative95.8%
mul-1-neg95.8%
unsub-neg95.8%
Simplified95.8%
Taylor expanded in x around 0 83.6%
if -2.24999999999999984e-21 < z < 7.20000000000000048e26Initial program 72.4%
Taylor expanded in z around 0 79.1%
mul-1-neg79.1%
+-commutative79.1%
Simplified79.1%
Final simplification80.5%
(FPCore (x y z)
:precision binary64
(if (<= y -9.3e+55)
(- z)
(if (<= y -1.75e-264)
(+ x y)
(if (<= y 2.7e+97) (/ x (- 1.0 (/ y z))) (- z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -9.3e+55) {
tmp = -z;
} else if (y <= -1.75e-264) {
tmp = x + y;
} else if (y <= 2.7e+97) {
tmp = x / (1.0 - (y / z));
} 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 <= (-9.3d+55)) then
tmp = -z
else if (y <= (-1.75d-264)) then
tmp = x + y
else if (y <= 2.7d+97) then
tmp = x / (1.0d0 - (y / z))
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -9.3e+55) {
tmp = -z;
} else if (y <= -1.75e-264) {
tmp = x + y;
} else if (y <= 2.7e+97) {
tmp = x / (1.0 - (y / z));
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -9.3e+55: tmp = -z elif y <= -1.75e-264: tmp = x + y elif y <= 2.7e+97: tmp = x / (1.0 - (y / z)) else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -9.3e+55) tmp = Float64(-z); elseif (y <= -1.75e-264) tmp = Float64(x + y); elseif (y <= 2.7e+97) tmp = Float64(x / Float64(1.0 - Float64(y / z))); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -9.3e+55) tmp = -z; elseif (y <= -1.75e-264) tmp = x + y; elseif (y <= 2.7e+97) tmp = x / (1.0 - (y / z)); else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -9.3e+55], (-z), If[LessEqual[y, -1.75e-264], N[(x + y), $MachinePrecision], If[LessEqual[y, 2.7e+97], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-z)]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.3 \cdot 10^{+55}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq -1.75 \cdot 10^{-264}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{+97}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -9.30000000000000035e55 or 2.69999999999999993e97 < y Initial program 69.9%
Taylor expanded in y around inf 69.0%
mul-1-neg69.0%
Simplified69.0%
if -9.30000000000000035e55 < y < -1.75e-264Initial program 98.8%
Taylor expanded in z around inf 74.0%
+-commutative74.0%
Simplified74.0%
if -1.75e-264 < y < 2.69999999999999993e97Initial program 96.6%
Taylor expanded in x around inf 68.7%
Final simplification70.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (/ y z))))
(if (<= y -5e+165)
(- z)
(if (<= y -9.1e-66) (/ y t_0) (if (<= y 6.5e+98) (/ x t_0) (- z))))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (y / z);
double tmp;
if (y <= -5e+165) {
tmp = -z;
} else if (y <= -9.1e-66) {
tmp = y / t_0;
} else if (y <= 6.5e+98) {
tmp = x / t_0;
} 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 <= (-5d+165)) then
tmp = -z
else if (y <= (-9.1d-66)) then
tmp = y / t_0
else if (y <= 6.5d+98) then
tmp = x / t_0
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 <= -5e+165) {
tmp = -z;
} else if (y <= -9.1e-66) {
tmp = y / t_0;
} else if (y <= 6.5e+98) {
tmp = x / t_0;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (y / z) tmp = 0 if y <= -5e+165: tmp = -z elif y <= -9.1e-66: tmp = y / t_0 elif y <= 6.5e+98: tmp = x / t_0 else: tmp = -z return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(y / z)) tmp = 0.0 if (y <= -5e+165) tmp = Float64(-z); elseif (y <= -9.1e-66) tmp = Float64(y / t_0); elseif (y <= 6.5e+98) tmp = Float64(x / t_0); 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 <= -5e+165) tmp = -z; elseif (y <= -9.1e-66) tmp = y / t_0; elseif (y <= 6.5e+98) tmp = x / t_0; 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, -5e+165], (-z), If[LessEqual[y, -9.1e-66], N[(y / t$95$0), $MachinePrecision], If[LessEqual[y, 6.5e+98], N[(x / t$95$0), $MachinePrecision], (-z)]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{y}{z}\\
\mathbf{if}\;y \leq -5 \cdot 10^{+165}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq -9.1 \cdot 10^{-66}:\\
\;\;\;\;\frac{y}{t\_0}\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+98}:\\
\;\;\;\;\frac{x}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -4.9999999999999997e165 or 6.4999999999999999e98 < y Initial program 66.3%
Taylor expanded in y around inf 72.4%
mul-1-neg72.4%
Simplified72.4%
if -4.9999999999999997e165 < y < -9.1000000000000001e-66Initial program 94.1%
Taylor expanded in x around 0 70.1%
if -9.1000000000000001e-66 < y < 6.4999999999999999e98Initial program 97.7%
Taylor expanded in x around inf 72.3%
Final simplification71.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.26e+41) (not (<= z 2.1e+27))) (+ x y) (* (- z) (/ (+ x y) y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.26e+41) || !(z <= 2.1e+27)) {
tmp = x + y;
} else {
tmp = -z * ((x + y) / 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 <= (-1.26d+41)) .or. (.not. (z <= 2.1d+27))) then
tmp = x + y
else
tmp = -z * ((x + y) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.26e+41) || !(z <= 2.1e+27)) {
tmp = x + y;
} else {
tmp = -z * ((x + y) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.26e+41) or not (z <= 2.1e+27): tmp = x + y else: tmp = -z * ((x + y) / y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.26e+41) || !(z <= 2.1e+27)) tmp = Float64(x + y); else tmp = Float64(Float64(-z) * Float64(Float64(x + y) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.26e+41) || ~((z <= 2.1e+27))) tmp = x + y; else tmp = -z * ((x + y) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.26e+41], N[Not[LessEqual[z, 2.1e+27]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[((-z) * N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.26 \cdot 10^{+41} \lor \neg \left(z \leq 2.1 \cdot 10^{+27}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\left(-z\right) \cdot \frac{x + y}{y}\\
\end{array}
\end{array}
if z < -1.26000000000000001e41 or 2.09999999999999995e27 < z Initial program 99.9%
Taylor expanded in z around inf 81.7%
+-commutative81.7%
Simplified81.7%
if -1.26000000000000001e41 < z < 2.09999999999999995e27Initial program 74.7%
Taylor expanded in z around 0 75.7%
mul-1-neg75.7%
associate-/l*80.1%
distribute-rgt-neg-in80.1%
distribute-neg-frac280.1%
+-commutative80.1%
Simplified80.1%
Final simplification80.9%
(FPCore (x y z) :precision binary64 (if (<= y -300000000000.0) (- z) (if (<= y -1.3e-114) y (if (<= y 3.5e-15) x (- z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -300000000000.0) {
tmp = -z;
} else if (y <= -1.3e-114) {
tmp = y;
} else if (y <= 3.5e-15) {
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 <= (-300000000000.0d0)) then
tmp = -z
else if (y <= (-1.3d-114)) then
tmp = y
else if (y <= 3.5d-15) 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 <= -300000000000.0) {
tmp = -z;
} else if (y <= -1.3e-114) {
tmp = y;
} else if (y <= 3.5e-15) {
tmp = x;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -300000000000.0: tmp = -z elif y <= -1.3e-114: tmp = y elif y <= 3.5e-15: tmp = x else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -300000000000.0) tmp = Float64(-z); elseif (y <= -1.3e-114) tmp = y; elseif (y <= 3.5e-15) tmp = x; else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -300000000000.0) tmp = -z; elseif (y <= -1.3e-114) tmp = y; elseif (y <= 3.5e-15) tmp = x; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -300000000000.0], (-z), If[LessEqual[y, -1.3e-114], y, If[LessEqual[y, 3.5e-15], x, (-z)]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -300000000000:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq -1.3 \cdot 10^{-114}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 3.5 \cdot 10^{-15}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -3e11 or 3.5000000000000001e-15 < y Initial program 73.7%
Taylor expanded in y around inf 61.0%
mul-1-neg61.0%
Simplified61.0%
if -3e11 < y < -1.30000000000000007e-114Initial program 99.9%
Taylor expanded in x around 0 66.7%
Taylor expanded in y around 0 48.8%
if -1.30000000000000007e-114 < y < 3.5000000000000001e-15Initial program 99.9%
Taylor expanded in y around 0 62.6%
Final simplification60.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -9.1e-66) (not (<= y 6.4e-20))) (/ z (+ (/ z y) -1.0)) (/ x (- 1.0 (/ y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -9.1e-66) || !(y <= 6.4e-20)) {
tmp = z / ((z / y) + -1.0);
} else {
tmp = x / (1.0 - (y / 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 <= (-9.1d-66)) .or. (.not. (y <= 6.4d-20))) then
tmp = z / ((z / y) + (-1.0d0))
else
tmp = x / (1.0d0 - (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -9.1e-66) || !(y <= 6.4e-20)) {
tmp = z / ((z / y) + -1.0);
} else {
tmp = x / (1.0 - (y / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -9.1e-66) or not (y <= 6.4e-20): tmp = z / ((z / y) + -1.0) else: tmp = x / (1.0 - (y / z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -9.1e-66) || !(y <= 6.4e-20)) tmp = Float64(z / Float64(Float64(z / y) + -1.0)); else tmp = Float64(x / Float64(1.0 - Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -9.1e-66) || ~((y <= 6.4e-20))) tmp = z / ((z / y) + -1.0); else tmp = x / (1.0 - (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -9.1e-66], N[Not[LessEqual[y, 6.4e-20]], $MachinePrecision]], N[(z / N[(N[(z / y), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.1 \cdot 10^{-66} \lor \neg \left(y \leq 6.4 \cdot 10^{-20}\right):\\
\;\;\;\;\frac{z}{\frac{z}{y} + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\
\end{array}
\end{array}
if y < -9.1000000000000001e-66 or 6.39999999999999941e-20 < y Initial program 77.3%
clear-num77.2%
inv-pow77.2%
Applied egg-rr77.2%
Taylor expanded in z around 0 99.0%
+-commutative99.0%
mul-1-neg99.0%
unsub-neg99.0%
Simplified99.0%
Taylor expanded in x around 0 77.6%
if -9.1000000000000001e-66 < y < 6.39999999999999941e-20Initial program 99.9%
Taylor expanded in x around inf 77.0%
Final simplification77.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -7.6e+55) (not (<= y 9.2e+97))) (- z) (+ x y)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -7.6e+55) || !(y <= 9.2e+97)) {
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 <= (-7.6d+55)) .or. (.not. (y <= 9.2d+97))) 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 <= -7.6e+55) || !(y <= 9.2e+97)) {
tmp = -z;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -7.6e+55) or not (y <= 9.2e+97): tmp = -z else: tmp = x + y return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -7.6e+55) || !(y <= 9.2e+97)) tmp = Float64(-z); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -7.6e+55) || ~((y <= 9.2e+97))) tmp = -z; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -7.6e+55], N[Not[LessEqual[y, 9.2e+97]], $MachinePrecision]], (-z), N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.6 \cdot 10^{+55} \lor \neg \left(y \leq 9.2 \cdot 10^{+97}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if y < -7.5999999999999999e55 or 9.20000000000000022e97 < y Initial program 69.9%
Taylor expanded in y around inf 69.0%
mul-1-neg69.0%
Simplified69.0%
if -7.5999999999999999e55 < y < 9.20000000000000022e97Initial program 97.6%
Taylor expanded in z around inf 68.6%
+-commutative68.6%
Simplified68.6%
Final simplification68.8%
(FPCore (x y z) :precision binary64 (if (<= x -5.5e-169) x (if (<= x 105.0) y x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.5e-169) {
tmp = x;
} else if (x <= 105.0) {
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 <= (-5.5d-169)) then
tmp = x
else if (x <= 105.0d0) 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 <= -5.5e-169) {
tmp = x;
} else if (x <= 105.0) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.5e-169: tmp = x elif x <= 105.0: tmp = y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5.5e-169) tmp = x; elseif (x <= 105.0) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -5.5e-169) tmp = x; elseif (x <= 105.0) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5.5e-169], x, If[LessEqual[x, 105.0], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{-169}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 105:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -5.4999999999999994e-169 or 105 < x Initial program 87.1%
Taylor expanded in y around 0 44.5%
if -5.4999999999999994e-169 < x < 105Initial program 87.2%
Taylor expanded in x around 0 75.1%
Taylor expanded in y around 0 42.4%
Final simplification43.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 87.1%
Taylor expanded in y around 0 31.7%
Final simplification31.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 2024075
(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))))