
(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-265) (not (<= t_0 0.0))) t_0 (- (- z) (* z (/ x y))))))
double code(double x, double y, double z) {
double t_0 = (x + y) / (1.0 - (y / z));
double tmp;
if ((t_0 <= -5e-265) || !(t_0 <= 0.0)) {
tmp = t_0;
} else {
tmp = -z - (z * (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 = (x + y) / (1.0d0 - (y / z))
if ((t_0 <= (-5d-265)) .or. (.not. (t_0 <= 0.0d0))) then
tmp = t_0
else
tmp = -z - (z * (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + y) / (1.0 - (y / z));
double tmp;
if ((t_0 <= -5e-265) || !(t_0 <= 0.0)) {
tmp = t_0;
} else {
tmp = -z - (z * (x / y));
}
return tmp;
}
def code(x, y, z): t_0 = (x + y) / (1.0 - (y / z)) tmp = 0 if (t_0 <= -5e-265) or not (t_0 <= 0.0): tmp = t_0 else: tmp = -z - (z * (x / y)) return tmp
function code(x, y, z) t_0 = Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))) tmp = 0.0 if ((t_0 <= -5e-265) || !(t_0 <= 0.0)) tmp = t_0; else tmp = Float64(Float64(-z) - Float64(z * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + y) / (1.0 - (y / z)); tmp = 0.0; if ((t_0 <= -5e-265) || ~((t_0 <= 0.0))) tmp = t_0; else tmp = -z - (z * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-265], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], t$95$0, N[((-z) - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + y}{1 - \frac{y}{z}}\\
\mathbf{if}\;t_0 \leq -5 \cdot 10^{-265} \lor \neg \left(t_0 \leq 0\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left(-z\right) - z \cdot \frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) < -5.0000000000000001e-265 or -0.0 < (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) Initial program 99.9%
if -5.0000000000000001e-265 < (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) < -0.0Initial program 11.1%
Taylor expanded in z around 0 97.2%
mul-1-neg97.2%
+-commutative97.2%
*-commutative97.2%
+-commutative97.2%
Simplified97.2%
Taylor expanded in y around 0 97.4%
+-commutative97.4%
*-commutative97.4%
associate-*r/86.7%
Simplified86.7%
Taylor expanded in x around 0 97.4%
associate-*r/100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (/ y z))) (t_1 (/ y t_0)))
(if (<= y -1.7e+128)
(- z)
(if (<= y -2.5e+58)
t_1
(if (<= y 8.5e+22) (/ x t_0) (if (<= y 6.2e+206) t_1 (- z)))))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (y / z);
double t_1 = y / t_0;
double tmp;
if (y <= -1.7e+128) {
tmp = -z;
} else if (y <= -2.5e+58) {
tmp = t_1;
} else if (y <= 8.5e+22) {
tmp = x / t_0;
} else if (y <= 6.2e+206) {
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 = y / t_0
if (y <= (-1.7d+128)) then
tmp = -z
else if (y <= (-2.5d+58)) then
tmp = t_1
else if (y <= 8.5d+22) then
tmp = x / t_0
else if (y <= 6.2d+206) 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 = y / t_0;
double tmp;
if (y <= -1.7e+128) {
tmp = -z;
} else if (y <= -2.5e+58) {
tmp = t_1;
} else if (y <= 8.5e+22) {
tmp = x / t_0;
} else if (y <= 6.2e+206) {
tmp = t_1;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (y / z) t_1 = y / t_0 tmp = 0 if y <= -1.7e+128: tmp = -z elif y <= -2.5e+58: tmp = t_1 elif y <= 8.5e+22: tmp = x / t_0 elif y <= 6.2e+206: tmp = t_1 else: tmp = -z return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(y / z)) t_1 = Float64(y / t_0) tmp = 0.0 if (y <= -1.7e+128) tmp = Float64(-z); elseif (y <= -2.5e+58) tmp = t_1; elseif (y <= 8.5e+22) tmp = Float64(x / t_0); elseif (y <= 6.2e+206) 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 = y / t_0; tmp = 0.0; if (y <= -1.7e+128) tmp = -z; elseif (y <= -2.5e+58) tmp = t_1; elseif (y <= 8.5e+22) tmp = x / t_0; elseif (y <= 6.2e+206) 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[(y / t$95$0), $MachinePrecision]}, If[LessEqual[y, -1.7e+128], (-z), If[LessEqual[y, -2.5e+58], t$95$1, If[LessEqual[y, 8.5e+22], N[(x / t$95$0), $MachinePrecision], If[LessEqual[y, 6.2e+206], t$95$1, (-z)]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{y}{z}\\
t_1 := \frac{y}{t_0}\\
\mathbf{if}\;y \leq -1.7 \cdot 10^{+128}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq -2.5 \cdot 10^{+58}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{+22}:\\
\;\;\;\;\frac{x}{t_0}\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{+206}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -1.6999999999999999e128 or 6.19999999999999981e206 < y Initial program 52.6%
Taylor expanded in y around inf 80.1%
mul-1-neg80.1%
Simplified80.1%
if -1.6999999999999999e128 < y < -2.49999999999999993e58 or 8.49999999999999979e22 < y < 6.19999999999999981e206Initial program 87.0%
Taylor expanded in x around 0 69.0%
if -2.49999999999999993e58 < y < 8.49999999999999979e22Initial program 99.8%
Taylor expanded in x around inf 75.7%
Final simplification75.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (- z) (* z (/ x y)))))
(if (<= y -0.124)
t_0
(if (<= y 7.5e-177)
(/ x (- 1.0 (/ y z)))
(if (<= y 6.2e-40) (* (+ x y) (+ 1.0 (/ y z))) t_0)))))
double code(double x, double y, double z) {
double t_0 = -z - (z * (x / y));
double tmp;
if (y <= -0.124) {
tmp = t_0;
} else if (y <= 7.5e-177) {
tmp = x / (1.0 - (y / z));
} else if (y <= 6.2e-40) {
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 = -z - (z * (x / y))
if (y <= (-0.124d0)) then
tmp = t_0
else if (y <= 7.5d-177) then
tmp = x / (1.0d0 - (y / z))
else if (y <= 6.2d-40) 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 = -z - (z * (x / y));
double tmp;
if (y <= -0.124) {
tmp = t_0;
} else if (y <= 7.5e-177) {
tmp = x / (1.0 - (y / z));
} else if (y <= 6.2e-40) {
tmp = (x + y) * (1.0 + (y / z));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -z - (z * (x / y)) tmp = 0 if y <= -0.124: tmp = t_0 elif y <= 7.5e-177: tmp = x / (1.0 - (y / z)) elif y <= 6.2e-40: tmp = (x + y) * (1.0 + (y / z)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(-z) - Float64(z * Float64(x / y))) tmp = 0.0 if (y <= -0.124) tmp = t_0; elseif (y <= 7.5e-177) tmp = Float64(x / Float64(1.0 - Float64(y / z))); elseif (y <= 6.2e-40) 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 = -z - (z * (x / y)); tmp = 0.0; if (y <= -0.124) tmp = t_0; elseif (y <= 7.5e-177) tmp = x / (1.0 - (y / z)); elseif (y <= 6.2e-40) 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[((-z) - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.124], t$95$0, If[LessEqual[y, 7.5e-177], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.2e-40], 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 := \left(-z\right) - z \cdot \frac{x}{y}\\
\mathbf{if}\;y \leq -0.124:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{-177}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{-40}:\\
\;\;\;\;\left(x + y\right) \cdot \left(1 + \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -0.124 or 6.20000000000000021e-40 < y Initial program 75.6%
Taylor expanded in z around 0 66.7%
mul-1-neg66.7%
+-commutative66.7%
*-commutative66.7%
+-commutative66.7%
Simplified66.7%
Taylor expanded in y around 0 71.8%
+-commutative71.8%
*-commutative71.8%
associate-*r/74.5%
Simplified74.5%
Taylor expanded in x around 0 71.8%
associate-*r/78.1%
Simplified78.1%
if -0.124 < y < 7.5e-177Initial program 99.9%
Taylor expanded in x around inf 84.0%
if 7.5e-177 < y < 6.20000000000000021e-40Initial program 99.9%
Taylor expanded in z around inf 81.0%
associate-/l*81.0%
+-commutative81.0%
associate-/r/81.0%
+-commutative81.0%
*-lft-identity81.0%
distribute-rgt-in81.0%
+-commutative81.0%
+-commutative81.0%
Simplified81.0%
Final simplification80.6%
(FPCore (x y z)
:precision binary64
(if (<= y -0.115)
(- z)
(if (<= y -3.8e-34)
x
(if (<= y -1.42e-61)
(- z)
(if (<= y -6.5e-112) y (if (<= y 1.76e-37) x (- z)))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -0.115) {
tmp = -z;
} else if (y <= -3.8e-34) {
tmp = x;
} else if (y <= -1.42e-61) {
tmp = -z;
} else if (y <= -6.5e-112) {
tmp = y;
} else if (y <= 1.76e-37) {
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 <= (-0.115d0)) then
tmp = -z
else if (y <= (-3.8d-34)) then
tmp = x
else if (y <= (-1.42d-61)) then
tmp = -z
else if (y <= (-6.5d-112)) then
tmp = y
else if (y <= 1.76d-37) 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 <= -0.115) {
tmp = -z;
} else if (y <= -3.8e-34) {
tmp = x;
} else if (y <= -1.42e-61) {
tmp = -z;
} else if (y <= -6.5e-112) {
tmp = y;
} else if (y <= 1.76e-37) {
tmp = x;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -0.115: tmp = -z elif y <= -3.8e-34: tmp = x elif y <= -1.42e-61: tmp = -z elif y <= -6.5e-112: tmp = y elif y <= 1.76e-37: tmp = x else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -0.115) tmp = Float64(-z); elseif (y <= -3.8e-34) tmp = x; elseif (y <= -1.42e-61) tmp = Float64(-z); elseif (y <= -6.5e-112) tmp = y; elseif (y <= 1.76e-37) tmp = x; else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -0.115) tmp = -z; elseif (y <= -3.8e-34) tmp = x; elseif (y <= -1.42e-61) tmp = -z; elseif (y <= -6.5e-112) tmp = y; elseif (y <= 1.76e-37) tmp = x; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -0.115], (-z), If[LessEqual[y, -3.8e-34], x, If[LessEqual[y, -1.42e-61], (-z), If[LessEqual[y, -6.5e-112], y, If[LessEqual[y, 1.76e-37], x, (-z)]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.115:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq -3.8 \cdot 10^{-34}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1.42 \cdot 10^{-61}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq -6.5 \cdot 10^{-112}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 1.76 \cdot 10^{-37}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -0.115000000000000005 or -3.8000000000000001e-34 < y < -1.42e-61 or 1.76000000000000006e-37 < y Initial program 76.3%
Taylor expanded in y around inf 59.8%
mul-1-neg59.8%
Simplified59.8%
if -0.115000000000000005 < y < -3.8000000000000001e-34 or -6.49999999999999956e-112 < y < 1.76000000000000006e-37Initial program 99.9%
Taylor expanded in y around 0 66.3%
if -1.42e-61 < y < -6.49999999999999956e-112Initial program 99.8%
Taylor expanded in x around 0 46.0%
Taylor expanded in y around 0 45.8%
Final simplification62.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.125) (not (<= y 4.7e-39))) (- (- z) (* x (/ z y))) (/ x (- 1.0 (/ y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.125) || !(y <= 4.7e-39)) {
tmp = -z - (x * (z / y));
} 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 <= (-0.125d0)) .or. (.not. (y <= 4.7d-39))) then
tmp = -z - (x * (z / y))
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 <= -0.125) || !(y <= 4.7e-39)) {
tmp = -z - (x * (z / y));
} else {
tmp = x / (1.0 - (y / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.125) or not (y <= 4.7e-39): tmp = -z - (x * (z / y)) else: tmp = x / (1.0 - (y / z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.125) || !(y <= 4.7e-39)) tmp = Float64(Float64(-z) - Float64(x * Float64(z / y))); 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 <= -0.125) || ~((y <= 4.7e-39))) tmp = -z - (x * (z / y)); else tmp = x / (1.0 - (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.125], N[Not[LessEqual[y, 4.7e-39]], $MachinePrecision]], N[((-z) - N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.125 \lor \neg \left(y \leq 4.7 \cdot 10^{-39}\right):\\
\;\;\;\;\left(-z\right) - x \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\
\end{array}
\end{array}
if y < -0.125 or 4.7000000000000002e-39 < y Initial program 75.6%
Taylor expanded in z around 0 66.7%
mul-1-neg66.7%
+-commutative66.7%
*-commutative66.7%
+-commutative66.7%
Simplified66.7%
Taylor expanded in y around 0 71.8%
+-commutative71.8%
*-commutative71.8%
associate-*r/74.5%
Simplified74.5%
if -0.125 < y < 4.7000000000000002e-39Initial program 99.9%
Taylor expanded in x around inf 79.6%
Final simplification77.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.082) (not (<= y 4.3e-40))) (- (- z) (* z (/ x y))) (/ x (- 1.0 (/ y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.082) || !(y <= 4.3e-40)) {
tmp = -z - (z * (x / y));
} 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 <= (-0.082d0)) .or. (.not. (y <= 4.3d-40))) then
tmp = -z - (z * (x / y))
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 <= -0.082) || !(y <= 4.3e-40)) {
tmp = -z - (z * (x / y));
} else {
tmp = x / (1.0 - (y / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.082) or not (y <= 4.3e-40): tmp = -z - (z * (x / y)) else: tmp = x / (1.0 - (y / z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.082) || !(y <= 4.3e-40)) tmp = Float64(Float64(-z) - Float64(z * Float64(x / y))); 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 <= -0.082) || ~((y <= 4.3e-40))) tmp = -z - (z * (x / y)); else tmp = x / (1.0 - (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.082], N[Not[LessEqual[y, 4.3e-40]], $MachinePrecision]], N[((-z) - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.082 \lor \neg \left(y \leq 4.3 \cdot 10^{-40}\right):\\
\;\;\;\;\left(-z\right) - z \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\
\end{array}
\end{array}
if y < -0.0820000000000000034 or 4.3000000000000003e-40 < y Initial program 75.6%
Taylor expanded in z around 0 66.7%
mul-1-neg66.7%
+-commutative66.7%
*-commutative66.7%
+-commutative66.7%
Simplified66.7%
Taylor expanded in y around 0 71.8%
+-commutative71.8%
*-commutative71.8%
associate-*r/74.5%
Simplified74.5%
Taylor expanded in x around 0 71.8%
associate-*r/78.1%
Simplified78.1%
if -0.0820000000000000034 < y < 4.3000000000000003e-40Initial program 99.9%
Taylor expanded in x around inf 79.6%
Final simplification78.8%
(FPCore (x y z) :precision binary64 (if (<= y -3.8e+60) (- z) (if (<= y 6.2e+25) (/ x (- 1.0 (/ y z))) (- z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.8e+60) {
tmp = -z;
} else if (y <= 6.2e+25) {
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 <= (-3.8d+60)) then
tmp = -z
else if (y <= 6.2d+25) 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 <= -3.8e+60) {
tmp = -z;
} else if (y <= 6.2e+25) {
tmp = x / (1.0 - (y / z));
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.8e+60: tmp = -z elif y <= 6.2e+25: tmp = x / (1.0 - (y / z)) else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.8e+60) tmp = Float64(-z); elseif (y <= 6.2e+25) 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 <= -3.8e+60) tmp = -z; elseif (y <= 6.2e+25) tmp = x / (1.0 - (y / z)); else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.8e+60], (-z), If[LessEqual[y, 6.2e+25], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{+60}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{+25}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -3.80000000000000009e60 or 6.1999999999999996e25 < y Initial program 70.6%
Taylor expanded in y around inf 64.3%
mul-1-neg64.3%
Simplified64.3%
if -3.80000000000000009e60 < y < 6.1999999999999996e25Initial program 99.8%
Taylor expanded in x around inf 75.7%
Final simplification70.8%
(FPCore (x y z) :precision binary64 (if (<= y -0.15) (- z) (if (<= y 1.76e-37) (+ x y) (- z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -0.15) {
tmp = -z;
} else if (y <= 1.76e-37) {
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 <= (-0.15d0)) then
tmp = -z
else if (y <= 1.76d-37) 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 <= -0.15) {
tmp = -z;
} else if (y <= 1.76e-37) {
tmp = x + y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -0.15: tmp = -z elif y <= 1.76e-37: tmp = x + y else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -0.15) tmp = Float64(-z); elseif (y <= 1.76e-37) tmp = Float64(x + y); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -0.15) tmp = -z; elseif (y <= 1.76e-37) tmp = x + y; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -0.15], (-z), If[LessEqual[y, 1.76e-37], N[(x + y), $MachinePrecision], (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.15:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 1.76 \cdot 10^{-37}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -0.149999999999999994 or 1.76000000000000006e-37 < y Initial program 75.6%
Taylor expanded in y around inf 60.4%
mul-1-neg60.4%
Simplified60.4%
if -0.149999999999999994 < y < 1.76000000000000006e-37Initial program 99.9%
Taylor expanded in z around inf 75.9%
Final simplification67.9%
(FPCore (x y z) :precision binary64 (if (<= x -2.05e-206) x (if (<= x 4.5e-28) y x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.05e-206) {
tmp = x;
} else if (x <= 4.5e-28) {
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 <= (-2.05d-206)) then
tmp = x
else if (x <= 4.5d-28) 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 <= -2.05e-206) {
tmp = x;
} else if (x <= 4.5e-28) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.05e-206: tmp = x elif x <= 4.5e-28: tmp = y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.05e-206) tmp = x; elseif (x <= 4.5e-28) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.05e-206) tmp = x; elseif (x <= 4.5e-28) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.05e-206], x, If[LessEqual[x, 4.5e-28], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.05 \cdot 10^{-206}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-28}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.05000000000000008e-206 or 4.4999999999999998e-28 < x Initial program 86.9%
Taylor expanded in y around 0 40.8%
if -2.05000000000000008e-206 < x < 4.4999999999999998e-28Initial program 88.5%
Taylor expanded in x around 0 71.1%
Taylor expanded in y around 0 40.3%
Final simplification40.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.4%
Taylor expanded in y around 0 33.2%
Final simplification33.2%
(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 2023257
(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))))