
(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-283) (not (<= t_0 0.0))) t_0 (/ z (/ y (- (- 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-283) || !(t_0 <= 0.0)) {
tmp = t_0;
} else {
tmp = z / (y / (-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-283)) .or. (.not. (t_0 <= 0.0d0))) then
tmp = t_0
else
tmp = z / (y / (-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-283) || !(t_0 <= 0.0)) {
tmp = t_0;
} else {
tmp = z / (y / (-y - x));
}
return tmp;
}
def code(x, y, z): t_0 = (x + y) / (1.0 - (y / z)) tmp = 0 if (t_0 <= -1e-283) or not (t_0 <= 0.0): tmp = t_0 else: tmp = z / (y / (-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-283) || !(t_0 <= 0.0)) tmp = t_0; else tmp = Float64(z / Float64(y / Float64(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-283) || ~((t_0 <= 0.0))) tmp = t_0; else tmp = z / (y / (-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-283], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], t$95$0, N[(z / N[(y / 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^{-283} \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{y}{\left(-y\right) - x}}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -9.99999999999999947e-284 or 0.0 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) Initial program 99.9%
if -9.99999999999999947e-284 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 0.0Initial program 12.4%
flip--3.1%
associate-/r/0.6%
metadata-eval0.6%
pow20.6%
Applied egg-rr0.6%
Taylor expanded in z around 0 94.6%
mul-1-neg94.6%
associate-/l*99.9%
distribute-rgt-neg-in99.9%
distribute-neg-frac299.9%
+-commutative99.9%
Simplified99.9%
associate-*r/94.6%
distribute-frac-neg294.6%
add-sqr-sqrt42.3%
sqrt-unprod30.4%
sqr-neg30.4%
sqrt-unprod3.1%
add-sqr-sqrt5.8%
associate-*r/5.7%
clear-num5.7%
un-div-inv5.7%
add-sqr-sqrt3.0%
sqrt-unprod30.4%
sqr-neg30.4%
sqrt-unprod42.3%
add-sqr-sqrt100.0%
+-commutative100.0%
Applied egg-rr100.0%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ x (- 1.0 (/ y z)))))
(if (<= y -4e+59)
(- z)
(if (<= y 4.1e-107)
(+ x y)
(if (<= y 9.2e+45)
t_0
(if (<= y 1e+66)
(* y (+ 1.0 (/ y z)))
(if (<= y 2.1e+103) t_0 (- z))))))))
double code(double x, double y, double z) {
double t_0 = x / (1.0 - (y / z));
double tmp;
if (y <= -4e+59) {
tmp = -z;
} else if (y <= 4.1e-107) {
tmp = x + y;
} else if (y <= 9.2e+45) {
tmp = t_0;
} else if (y <= 1e+66) {
tmp = y * (1.0 + (y / z));
} else if (y <= 2.1e+103) {
tmp = 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 = x / (1.0d0 - (y / z))
if (y <= (-4d+59)) then
tmp = -z
else if (y <= 4.1d-107) then
tmp = x + y
else if (y <= 9.2d+45) then
tmp = t_0
else if (y <= 1d+66) then
tmp = y * (1.0d0 + (y / z))
else if (y <= 2.1d+103) then
tmp = t_0
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 <= -4e+59) {
tmp = -z;
} else if (y <= 4.1e-107) {
tmp = x + y;
} else if (y <= 9.2e+45) {
tmp = t_0;
} else if (y <= 1e+66) {
tmp = y * (1.0 + (y / z));
} else if (y <= 2.1e+103) {
tmp = t_0;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): t_0 = x / (1.0 - (y / z)) tmp = 0 if y <= -4e+59: tmp = -z elif y <= 4.1e-107: tmp = x + y elif y <= 9.2e+45: tmp = t_0 elif y <= 1e+66: tmp = y * (1.0 + (y / z)) elif y <= 2.1e+103: tmp = t_0 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 <= -4e+59) tmp = Float64(-z); elseif (y <= 4.1e-107) tmp = Float64(x + y); elseif (y <= 9.2e+45) tmp = t_0; elseif (y <= 1e+66) tmp = Float64(y * Float64(1.0 + Float64(y / z))); elseif (y <= 2.1e+103) tmp = t_0; 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 <= -4e+59) tmp = -z; elseif (y <= 4.1e-107) tmp = x + y; elseif (y <= 9.2e+45) tmp = t_0; elseif (y <= 1e+66) tmp = y * (1.0 + (y / z)); elseif (y <= 2.1e+103) tmp = t_0; 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, -4e+59], (-z), If[LessEqual[y, 4.1e-107], N[(x + y), $MachinePrecision], If[LessEqual[y, 9.2e+45], t$95$0, If[LessEqual[y, 1e+66], N[(y * N[(1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.1e+103], t$95$0, (-z)]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{1 - \frac{y}{z}}\\
\mathbf{if}\;y \leq -4 \cdot 10^{+59}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{-107}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 9.2 \cdot 10^{+45}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 10^{+66}:\\
\;\;\;\;y \cdot \left(1 + \frac{y}{z}\right)\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{+103}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -3.99999999999999989e59 or 2.1000000000000002e103 < y Initial program 68.5%
Taylor expanded in y around inf 73.4%
mul-1-neg73.4%
Simplified73.4%
if -3.99999999999999989e59 < y < 4.0999999999999999e-107Initial program 98.4%
Taylor expanded in z around inf 75.6%
+-commutative75.6%
Simplified75.6%
if 4.0999999999999999e-107 < y < 9.20000000000000049e45 or 9.99999999999999945e65 < y < 2.1000000000000002e103Initial program 93.6%
Taylor expanded in x around inf 72.7%
if 9.20000000000000049e45 < y < 9.99999999999999945e65Initial program 100.0%
Taylor expanded in x around 0 97.1%
Taylor expanded in y around 0 64.6%
Final simplification74.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (/ y z))))
(if (<= y -2.8e+63)
(- z)
(if (<= y 3.6e-107)
(+ x y)
(if (<= y 2.15e+38) (/ x t_0) (if (<= y 4.8e+75) (/ y t_0) (- z)))))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (y / z);
double tmp;
if (y <= -2.8e+63) {
tmp = -z;
} else if (y <= 3.6e-107) {
tmp = x + y;
} else if (y <= 2.15e+38) {
tmp = x / t_0;
} else if (y <= 4.8e+75) {
tmp = y / 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 <= (-2.8d+63)) then
tmp = -z
else if (y <= 3.6d-107) then
tmp = x + y
else if (y <= 2.15d+38) then
tmp = x / t_0
else if (y <= 4.8d+75) then
tmp = y / 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 <= -2.8e+63) {
tmp = -z;
} else if (y <= 3.6e-107) {
tmp = x + y;
} else if (y <= 2.15e+38) {
tmp = x / t_0;
} else if (y <= 4.8e+75) {
tmp = y / t_0;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (y / z) tmp = 0 if y <= -2.8e+63: tmp = -z elif y <= 3.6e-107: tmp = x + y elif y <= 2.15e+38: tmp = x / t_0 elif y <= 4.8e+75: tmp = y / 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 <= -2.8e+63) tmp = Float64(-z); elseif (y <= 3.6e-107) tmp = Float64(x + y); elseif (y <= 2.15e+38) tmp = Float64(x / t_0); elseif (y <= 4.8e+75) tmp = Float64(y / 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 <= -2.8e+63) tmp = -z; elseif (y <= 3.6e-107) tmp = x + y; elseif (y <= 2.15e+38) tmp = x / t_0; elseif (y <= 4.8e+75) tmp = y / 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, -2.8e+63], (-z), If[LessEqual[y, 3.6e-107], N[(x + y), $MachinePrecision], If[LessEqual[y, 2.15e+38], N[(x / t$95$0), $MachinePrecision], If[LessEqual[y, 4.8e+75], N[(y / t$95$0), $MachinePrecision], (-z)]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{y}{z}\\
\mathbf{if}\;y \leq -2.8 \cdot 10^{+63}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{-107}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 2.15 \cdot 10^{+38}:\\
\;\;\;\;\frac{x}{t\_0}\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{+75}:\\
\;\;\;\;\frac{y}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -2.79999999999999987e63 or 4.8e75 < y Initial program 69.6%
Taylor expanded in y around inf 71.1%
mul-1-neg71.1%
Simplified71.1%
if -2.79999999999999987e63 < y < 3.59999999999999976e-107Initial program 98.4%
Taylor expanded in z around inf 75.6%
+-commutative75.6%
Simplified75.6%
if 3.59999999999999976e-107 < y < 2.1499999999999998e38Initial program 97.2%
Taylor expanded in x around inf 74.9%
if 2.1499999999999998e38 < y < 4.8e75Initial program 88.7%
Taylor expanded in x around 0 86.2%
Final simplification74.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ z (/ y (- (- y) x)))))
(if (<= y -6.2e+41)
t_0
(if (<= y 3.9e-107)
(* (+ x y) (+ 1.0 (/ y z)))
(if (<= y 2.5e+27) (/ x (- 1.0 (/ y z))) t_0)))))
double code(double x, double y, double z) {
double t_0 = z / (y / (-y - x));
double tmp;
if (y <= -6.2e+41) {
tmp = t_0;
} else if (y <= 3.9e-107) {
tmp = (x + y) * (1.0 + (y / z));
} else if (y <= 2.5e+27) {
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 / (y / (-y - x))
if (y <= (-6.2d+41)) then
tmp = t_0
else if (y <= 3.9d-107) then
tmp = (x + y) * (1.0d0 + (y / z))
else if (y <= 2.5d+27) 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 / (y / (-y - x));
double tmp;
if (y <= -6.2e+41) {
tmp = t_0;
} else if (y <= 3.9e-107) {
tmp = (x + y) * (1.0 + (y / z));
} else if (y <= 2.5e+27) {
tmp = x / (1.0 - (y / z));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z / (y / (-y - x)) tmp = 0 if y <= -6.2e+41: tmp = t_0 elif y <= 3.9e-107: tmp = (x + y) * (1.0 + (y / z)) elif y <= 2.5e+27: tmp = x / (1.0 - (y / z)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z / Float64(y / Float64(Float64(-y) - x))) tmp = 0.0 if (y <= -6.2e+41) tmp = t_0; elseif (y <= 3.9e-107) tmp = Float64(Float64(x + y) * Float64(1.0 + Float64(y / z))); elseif (y <= 2.5e+27) 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 / (y / (-y - x)); tmp = 0.0; if (y <= -6.2e+41) tmp = t_0; elseif (y <= 3.9e-107) tmp = (x + y) * (1.0 + (y / z)); elseif (y <= 2.5e+27) 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[(y / N[((-y) - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.2e+41], t$95$0, If[LessEqual[y, 3.9e-107], N[(N[(x + y), $MachinePrecision] * N[(1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.5e+27], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{z}{\frac{y}{\left(-y\right) - x}}\\
\mathbf{if}\;y \leq -6.2 \cdot 10^{+41}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3.9 \cdot 10^{-107}:\\
\;\;\;\;\left(x + y\right) \cdot \left(1 + \frac{y}{z}\right)\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{+27}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -6.2e41 or 2.4999999999999999e27 < y Initial program 71.4%
flip--49.7%
associate-/r/49.6%
metadata-eval49.6%
pow249.6%
Applied egg-rr49.6%
Taylor expanded in z around 0 66.6%
mul-1-neg66.6%
associate-/l*82.4%
distribute-rgt-neg-in82.4%
distribute-neg-frac282.4%
+-commutative82.4%
Simplified82.4%
associate-*r/66.6%
distribute-frac-neg266.6%
add-sqr-sqrt31.0%
sqrt-unprod19.5%
sqr-neg19.5%
sqrt-unprod1.2%
add-sqr-sqrt2.9%
associate-*r/3.0%
clear-num3.0%
un-div-inv3.0%
add-sqr-sqrt1.3%
sqrt-unprod20.0%
sqr-neg20.0%
sqrt-unprod36.7%
add-sqr-sqrt82.4%
+-commutative82.4%
Applied egg-rr82.4%
if -6.2e41 < y < 3.9000000000000001e-107Initial program 99.1%
Taylor expanded in z around inf 77.0%
associate-+r+77.0%
*-rgt-identity77.0%
*-commutative77.0%
associate-/l*77.5%
distribute-lft-in77.5%
+-commutative77.5%
Simplified77.5%
if 3.9000000000000001e-107 < y < 2.4999999999999999e27Initial program 99.8%
Taylor expanded in x around inf 76.1%
Final simplification79.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ z (/ y (- (- y) x)))))
(if (<= y -1e+42)
t_0
(if (<= y 4.5e-107)
(+ x y)
(if (<= y 2.3e+28) (/ x (- 1.0 (/ y z))) t_0)))))
double code(double x, double y, double z) {
double t_0 = z / (y / (-y - x));
double tmp;
if (y <= -1e+42) {
tmp = t_0;
} else if (y <= 4.5e-107) {
tmp = x + y;
} else if (y <= 2.3e+28) {
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 / (y / (-y - x))
if (y <= (-1d+42)) then
tmp = t_0
else if (y <= 4.5d-107) then
tmp = x + y
else if (y <= 2.3d+28) 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 / (y / (-y - x));
double tmp;
if (y <= -1e+42) {
tmp = t_0;
} else if (y <= 4.5e-107) {
tmp = x + y;
} else if (y <= 2.3e+28) {
tmp = x / (1.0 - (y / z));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z / (y / (-y - x)) tmp = 0 if y <= -1e+42: tmp = t_0 elif y <= 4.5e-107: tmp = x + y elif y <= 2.3e+28: tmp = x / (1.0 - (y / z)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z / Float64(y / Float64(Float64(-y) - x))) tmp = 0.0 if (y <= -1e+42) tmp = t_0; elseif (y <= 4.5e-107) tmp = Float64(x + y); elseif (y <= 2.3e+28) 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 / (y / (-y - x)); tmp = 0.0; if (y <= -1e+42) tmp = t_0; elseif (y <= 4.5e-107) tmp = x + y; elseif (y <= 2.3e+28) 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[(y / N[((-y) - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1e+42], t$95$0, If[LessEqual[y, 4.5e-107], N[(x + y), $MachinePrecision], If[LessEqual[y, 2.3e+28], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{z}{\frac{y}{\left(-y\right) - x}}\\
\mathbf{if}\;y \leq -1 \cdot 10^{+42}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{-107}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+28}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.00000000000000004e42 or 2.29999999999999984e28 < y Initial program 71.4%
flip--49.7%
associate-/r/49.6%
metadata-eval49.6%
pow249.6%
Applied egg-rr49.6%
Taylor expanded in z around 0 66.6%
mul-1-neg66.6%
associate-/l*82.4%
distribute-rgt-neg-in82.4%
distribute-neg-frac282.4%
+-commutative82.4%
Simplified82.4%
associate-*r/66.6%
distribute-frac-neg266.6%
add-sqr-sqrt31.0%
sqrt-unprod19.5%
sqr-neg19.5%
sqrt-unprod1.2%
add-sqr-sqrt2.9%
associate-*r/3.0%
clear-num3.0%
un-div-inv3.0%
add-sqr-sqrt1.3%
sqrt-unprod20.0%
sqr-neg20.0%
sqrt-unprod36.7%
add-sqr-sqrt82.4%
+-commutative82.4%
Applied egg-rr82.4%
if -1.00000000000000004e42 < y < 4.50000000000000016e-107Initial program 99.1%
Taylor expanded in z around inf 77.1%
+-commutative77.1%
Simplified77.1%
if 4.50000000000000016e-107 < y < 2.29999999999999984e28Initial program 99.8%
Taylor expanded in x around inf 76.1%
Final simplification79.1%
(FPCore (x y z)
:precision binary64
(if (<= y -3.7e+61)
(- z)
(if (<= y 5.5e-54)
(+ x y)
(if (<= y 6e+44) (/ (* x z) (- y)) (if (<= y 3.1e+48) y (- z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.7e+61) {
tmp = -z;
} else if (y <= 5.5e-54) {
tmp = x + y;
} else if (y <= 6e+44) {
tmp = (x * z) / -y;
} else if (y <= 3.1e+48) {
tmp = 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 <= (-3.7d+61)) then
tmp = -z
else if (y <= 5.5d-54) then
tmp = x + y
else if (y <= 6d+44) then
tmp = (x * z) / -y
else if (y <= 3.1d+48) then
tmp = y
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.7e+61) {
tmp = -z;
} else if (y <= 5.5e-54) {
tmp = x + y;
} else if (y <= 6e+44) {
tmp = (x * z) / -y;
} else if (y <= 3.1e+48) {
tmp = y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.7e+61: tmp = -z elif y <= 5.5e-54: tmp = x + y elif y <= 6e+44: tmp = (x * z) / -y elif y <= 3.1e+48: tmp = y else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.7e+61) tmp = Float64(-z); elseif (y <= 5.5e-54) tmp = Float64(x + y); elseif (y <= 6e+44) tmp = Float64(Float64(x * z) / Float64(-y)); elseif (y <= 3.1e+48) tmp = y; else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.7e+61) tmp = -z; elseif (y <= 5.5e-54) tmp = x + y; elseif (y <= 6e+44) tmp = (x * z) / -y; elseif (y <= 3.1e+48) tmp = y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.7e+61], (-z), If[LessEqual[y, 5.5e-54], N[(x + y), $MachinePrecision], If[LessEqual[y, 6e+44], N[(N[(x * z), $MachinePrecision] / (-y)), $MachinePrecision], If[LessEqual[y, 3.1e+48], y, (-z)]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{+61}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-54}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+44}:\\
\;\;\;\;\frac{x \cdot z}{-y}\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+48}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -3.70000000000000003e61 or 3.10000000000000005e48 < y Initial program 70.9%
Taylor expanded in y around inf 70.0%
mul-1-neg70.0%
Simplified70.0%
if -3.70000000000000003e61 < y < 5.50000000000000046e-54Initial program 98.6%
Taylor expanded in z around inf 74.0%
+-commutative74.0%
Simplified74.0%
if 5.50000000000000046e-54 < y < 5.99999999999999974e44Initial program 91.5%
flip--81.9%
associate-/r/81.9%
metadata-eval81.9%
pow281.9%
Applied egg-rr81.9%
Taylor expanded in z around 0 61.1%
mul-1-neg61.1%
associate-/l*57.0%
distribute-rgt-neg-in57.0%
distribute-neg-frac257.0%
+-commutative57.0%
Simplified57.0%
Taylor expanded in y around 0 54.5%
mul-1-neg54.5%
associate-/l*47.9%
distribute-rgt-neg-in47.9%
distribute-neg-frac247.9%
Simplified47.9%
*-commutative47.9%
distribute-frac-neg247.9%
distribute-frac-neg47.9%
associate-*l/54.5%
Applied egg-rr54.5%
if 5.99999999999999974e44 < y < 3.10000000000000005e48Initial program 100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in y around 0 100.0%
Final simplification71.2%
(FPCore (x y z)
:precision binary64
(if (<= y -4.5e+63)
(- z)
(if (<= y 3.1e-10)
(+ x y)
(if (<= y 7e+45) (* (- z) (/ x y)) (if (<= y 2.2e+49) y (- z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.5e+63) {
tmp = -z;
} else if (y <= 3.1e-10) {
tmp = x + y;
} else if (y <= 7e+45) {
tmp = -z * (x / y);
} else if (y <= 2.2e+49) {
tmp = 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 <= (-4.5d+63)) then
tmp = -z
else if (y <= 3.1d-10) then
tmp = x + y
else if (y <= 7d+45) then
tmp = -z * (x / y)
else if (y <= 2.2d+49) then
tmp = y
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -4.5e+63) {
tmp = -z;
} else if (y <= 3.1e-10) {
tmp = x + y;
} else if (y <= 7e+45) {
tmp = -z * (x / y);
} else if (y <= 2.2e+49) {
tmp = y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.5e+63: tmp = -z elif y <= 3.1e-10: tmp = x + y elif y <= 7e+45: tmp = -z * (x / y) elif y <= 2.2e+49: tmp = y else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.5e+63) tmp = Float64(-z); elseif (y <= 3.1e-10) tmp = Float64(x + y); elseif (y <= 7e+45) tmp = Float64(Float64(-z) * Float64(x / y)); elseif (y <= 2.2e+49) tmp = y; else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4.5e+63) tmp = -z; elseif (y <= 3.1e-10) tmp = x + y; elseif (y <= 7e+45) tmp = -z * (x / y); elseif (y <= 2.2e+49) tmp = y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.5e+63], (-z), If[LessEqual[y, 3.1e-10], N[(x + y), $MachinePrecision], If[LessEqual[y, 7e+45], N[((-z) * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.2e+49], y, (-z)]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{+63}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{-10}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+45}:\\
\;\;\;\;\left(-z\right) \cdot \frac{x}{y}\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+49}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -4.50000000000000017e63 or 2.2000000000000001e49 < y Initial program 70.9%
Taylor expanded in y around inf 70.0%
mul-1-neg70.0%
Simplified70.0%
if -4.50000000000000017e63 < y < 3.10000000000000015e-10Initial program 98.7%
Taylor expanded in z around inf 71.5%
+-commutative71.5%
Simplified71.5%
if 3.10000000000000015e-10 < y < 7.00000000000000046e45Initial program 81.5%
flip--79.7%
associate-/r/79.5%
metadata-eval79.5%
pow279.5%
Applied egg-rr79.5%
Taylor expanded in z around 0 71.0%
mul-1-neg71.0%
associate-/l*71.2%
distribute-rgt-neg-in71.2%
distribute-neg-frac271.2%
+-commutative71.2%
Simplified71.2%
Taylor expanded in y around 0 66.7%
mul-1-neg66.7%
distribute-neg-frac266.7%
Simplified66.7%
if 7.00000000000000046e45 < y < 2.2000000000000001e49Initial program 100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in y around 0 100.0%
Final simplification71.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.6e+65) (not (<= y 3.5e+50))) (- z) (+ x y)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.6e+65) || !(y <= 3.5e+50)) {
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 <= (-1.6d+65)) .or. (.not. (y <= 3.5d+50))) 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 <= -1.6e+65) || !(y <= 3.5e+50)) {
tmp = -z;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.6e+65) or not (y <= 3.5e+50): tmp = -z else: tmp = x + y return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.6e+65) || !(y <= 3.5e+50)) tmp = Float64(-z); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.6e+65) || ~((y <= 3.5e+50))) tmp = -z; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.6e+65], N[Not[LessEqual[y, 3.5e+50]], $MachinePrecision]], (-z), N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{+65} \lor \neg \left(y \leq 3.5 \cdot 10^{+50}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if y < -1.60000000000000003e65 or 3.50000000000000006e50 < y Initial program 70.9%
Taylor expanded in y around inf 70.0%
mul-1-neg70.0%
Simplified70.0%
if -1.60000000000000003e65 < y < 3.50000000000000006e50Initial program 97.6%
Taylor expanded in z around inf 69.3%
+-commutative69.3%
Simplified69.3%
Final simplification69.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -1e+42) (not (<= y 1.25e+26))) (- z) x))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1e+42) || !(y <= 1.25e+26)) {
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 <= (-1d+42)) .or. (.not. (y <= 1.25d+26))) 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 <= -1e+42) || !(y <= 1.25e+26)) {
tmp = -z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1e+42) or not (y <= 1.25e+26): tmp = -z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1e+42) || !(y <= 1.25e+26)) tmp = Float64(-z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1e+42) || ~((y <= 1.25e+26))) tmp = -z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1e+42], N[Not[LessEqual[y, 1.25e+26]], $MachinePrecision]], (-z), x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{+42} \lor \neg \left(y \leq 1.25 \cdot 10^{+26}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.00000000000000004e42 or 1.25e26 < y Initial program 71.4%
Taylor expanded in y around inf 64.0%
mul-1-neg64.0%
Simplified64.0%
if -1.00000000000000004e42 < y < 1.25e26Initial program 99.3%
Taylor expanded in y around 0 54.2%
Final simplification58.2%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.9e-168) (not (<= x 2.65e-204))) x y))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.9e-168) || !(x <= 2.65e-204)) {
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 ((x <= (-1.9d-168)) .or. (.not. (x <= 2.65d-204))) 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 ((x <= -1.9e-168) || !(x <= 2.65e-204)) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.9e-168) or not (x <= 2.65e-204): tmp = x else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.9e-168) || !(x <= 2.65e-204)) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.9e-168) || ~((x <= 2.65e-204))) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.9e-168], N[Not[LessEqual[x, 2.65e-204]], $MachinePrecision]], x, y]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{-168} \lor \neg \left(x \leq 2.65 \cdot 10^{-204}\right):\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if x < -1.9e-168 or 2.6499999999999999e-204 < x Initial program 88.8%
Taylor expanded in y around 0 41.0%
if -1.9e-168 < x < 2.6499999999999999e-204Initial program 84.8%
Taylor expanded in x around 0 76.2%
Taylor expanded in y around 0 44.1%
Final simplification41.7%
(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.9%
Taylor expanded in y around 0 34.4%
(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 2024096
(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))))