
(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 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (+ x y) (- 1.0 (/ y z))))
double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + y) / (1.0d0 - (y / z))
end function
public static double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
def code(x, y, z): return (x + y) / (1.0 - (y / z))
function code(x, y, z) return Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))) end
function tmp = code(x, y, z) tmp = (x + y) / (1.0 - (y / z)); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y}{1 - \frac{y}{z}}
\end{array}
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (+ x y) (- 1.0 (/ y z)))))
(if (or (<= t_0 -2e-255) (not (<= t_0 5e-239)))
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 <= -2e-255) || !(t_0 <= 5e-239)) {
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 <= (-2d-255)) .or. (.not. (t_0 <= 5d-239))) 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 <= -2e-255) || !(t_0 <= 5e-239)) {
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 <= -2e-255) or not (t_0 <= 5e-239): 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 <= -2e-255) || !(t_0 <= 5e-239)) tmp = t_0; else tmp = Float64(Float64(Float64(x * Float64(-z)) / 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 <= -2e-255) || ~((t_0 <= 5e-239))) 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, -2e-255], N[Not[LessEqual[t$95$0, 5e-239]], $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 -2 \cdot 10^{-255} \lor \neg \left(t\_0 \leq 5 \cdot 10^{-239}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(-z\right)}{y} - z\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) < -2e-255 or 5e-239 < (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) Initial program 99.9%
if -2e-255 < (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) < 5e-239Initial program 15.9%
Taylor expanded in z around 0 97.3%
mul-1-neg97.3%
associate-/l*99.8%
distribute-neg-frac99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 100.0%
mul-1-neg100.0%
associate-*r/79.7%
unsub-neg79.7%
mul-1-neg79.7%
associate-*r/100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ x (- 1.0 (/ y z)))))
(if (<= y -2.8e+49)
(- z)
(if (<= y -1.3e-13)
(+ x y)
(if (<= y -4.2e-110)
t_0
(if (<= y 5.4e-115) (+ x y) (if (<= y 5e+91) t_0 (- z))))))))
double code(double x, double y, double z) {
double t_0 = x / (1.0 - (y / z));
double tmp;
if (y <= -2.8e+49) {
tmp = -z;
} else if (y <= -1.3e-13) {
tmp = x + y;
} else if (y <= -4.2e-110) {
tmp = t_0;
} else if (y <= 5.4e-115) {
tmp = x + y;
} else if (y <= 5e+91) {
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 <= (-2.8d+49)) then
tmp = -z
else if (y <= (-1.3d-13)) then
tmp = x + y
else if (y <= (-4.2d-110)) then
tmp = t_0
else if (y <= 5.4d-115) then
tmp = x + y
else if (y <= 5d+91) 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 <= -2.8e+49) {
tmp = -z;
} else if (y <= -1.3e-13) {
tmp = x + y;
} else if (y <= -4.2e-110) {
tmp = t_0;
} else if (y <= 5.4e-115) {
tmp = x + y;
} else if (y <= 5e+91) {
tmp = t_0;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): t_0 = x / (1.0 - (y / z)) tmp = 0 if y <= -2.8e+49: tmp = -z elif y <= -1.3e-13: tmp = x + y elif y <= -4.2e-110: tmp = t_0 elif y <= 5.4e-115: tmp = x + y elif y <= 5e+91: 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 <= -2.8e+49) tmp = Float64(-z); elseif (y <= -1.3e-13) tmp = Float64(x + y); elseif (y <= -4.2e-110) tmp = t_0; elseif (y <= 5.4e-115) tmp = Float64(x + y); elseif (y <= 5e+91) 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 <= -2.8e+49) tmp = -z; elseif (y <= -1.3e-13) tmp = x + y; elseif (y <= -4.2e-110) tmp = t_0; elseif (y <= 5.4e-115) tmp = x + y; elseif (y <= 5e+91) 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, -2.8e+49], (-z), If[LessEqual[y, -1.3e-13], N[(x + y), $MachinePrecision], If[LessEqual[y, -4.2e-110], t$95$0, If[LessEqual[y, 5.4e-115], N[(x + y), $MachinePrecision], If[LessEqual[y, 5e+91], t$95$0, (-z)]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{1 - \frac{y}{z}}\\
\mathbf{if}\;y \leq -2.8 \cdot 10^{+49}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq -1.3 \cdot 10^{-13}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq -4.2 \cdot 10^{-110}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{-115}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+91}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -2.7999999999999998e49 or 5.0000000000000002e91 < y Initial program 65.8%
Taylor expanded in y around inf 68.2%
mul-1-neg68.2%
Simplified68.2%
if -2.7999999999999998e49 < y < -1.3e-13 or -4.20000000000000004e-110 < y < 5.4e-115Initial program 100.0%
Taylor expanded in z around inf 90.7%
+-commutative90.7%
Simplified90.7%
if -1.3e-13 < y < -4.20000000000000004e-110 or 5.4e-115 < y < 5.0000000000000002e91Initial program 98.5%
Taylor expanded in x around inf 67.2%
Final simplification76.0%
(FPCore (x y z)
:precision binary64
(if (<= z -1.06e+185)
(+ x y)
(if (<= z -7.5e+89)
(/ y (- 1.0 (/ y z)))
(if (or (<= z -1e-28) (not (<= z 7.5e-8)))
(+ x y)
(- (/ (* x (- z)) y) z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.06e+185) {
tmp = x + y;
} else if (z <= -7.5e+89) {
tmp = y / (1.0 - (y / z));
} else if ((z <= -1e-28) || !(z <= 7.5e-8)) {
tmp = x + y;
} 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) :: tmp
if (z <= (-1.06d+185)) then
tmp = x + y
else if (z <= (-7.5d+89)) then
tmp = y / (1.0d0 - (y / z))
else if ((z <= (-1d-28)) .or. (.not. (z <= 7.5d-8))) then
tmp = x + y
else
tmp = ((x * -z) / y) - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.06e+185) {
tmp = x + y;
} else if (z <= -7.5e+89) {
tmp = y / (1.0 - (y / z));
} else if ((z <= -1e-28) || !(z <= 7.5e-8)) {
tmp = x + y;
} else {
tmp = ((x * -z) / y) - z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.06e+185: tmp = x + y elif z <= -7.5e+89: tmp = y / (1.0 - (y / z)) elif (z <= -1e-28) or not (z <= 7.5e-8): tmp = x + y else: tmp = ((x * -z) / y) - z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.06e+185) tmp = Float64(x + y); elseif (z <= -7.5e+89) tmp = Float64(y / Float64(1.0 - Float64(y / z))); elseif ((z <= -1e-28) || !(z <= 7.5e-8)) tmp = Float64(x + y); else tmp = Float64(Float64(Float64(x * Float64(-z)) / y) - z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.06e+185) tmp = x + y; elseif (z <= -7.5e+89) tmp = y / (1.0 - (y / z)); elseif ((z <= -1e-28) || ~((z <= 7.5e-8))) tmp = x + y; else tmp = ((x * -z) / y) - z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.06e+185], N[(x + y), $MachinePrecision], If[LessEqual[z, -7.5e+89], N[(y / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -1e-28], N[Not[LessEqual[z, 7.5e-8]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(N[(N[(x * (-z)), $MachinePrecision] / y), $MachinePrecision] - z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.06 \cdot 10^{+185}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq -7.5 \cdot 10^{+89}:\\
\;\;\;\;\frac{y}{1 - \frac{y}{z}}\\
\mathbf{elif}\;z \leq -1 \cdot 10^{-28} \lor \neg \left(z \leq 7.5 \cdot 10^{-8}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(-z\right)}{y} - z\\
\end{array}
\end{array}
if z < -1.06000000000000004e185 or -7.49999999999999947e89 < z < -9.99999999999999971e-29 or 7.4999999999999997e-8 < z Initial program 100.0%
Taylor expanded in z around inf 86.1%
+-commutative86.1%
Simplified86.1%
if -1.06000000000000004e185 < z < -7.49999999999999947e89Initial program 99.6%
Taylor expanded in x around 0 80.1%
if -9.99999999999999971e-29 < z < 7.4999999999999997e-8Initial program 74.3%
Taylor expanded in z around 0 77.7%
mul-1-neg77.7%
associate-/l*76.4%
distribute-neg-frac76.4%
+-commutative76.4%
Simplified76.4%
Taylor expanded in y around 0 79.3%
mul-1-neg79.3%
associate-*r/73.3%
unsub-neg73.3%
mul-1-neg73.3%
associate-*r/79.3%
Simplified79.3%
Final simplification82.4%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- 1.0 (/ y z)))) (if (or (<= x -2.05e-79) (not (<= x 112.0))) (/ x t_0) (/ y t_0))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (y / z);
double tmp;
if ((x <= -2.05e-79) || !(x <= 112.0)) {
tmp = x / t_0;
} else {
tmp = y / 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 = 1.0d0 - (y / z)
if ((x <= (-2.05d-79)) .or. (.not. (x <= 112.0d0))) then
tmp = x / t_0
else
tmp = y / t_0
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 ((x <= -2.05e-79) || !(x <= 112.0)) {
tmp = x / t_0;
} else {
tmp = y / t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (y / z) tmp = 0 if (x <= -2.05e-79) or not (x <= 112.0): tmp = x / t_0 else: tmp = y / t_0 return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(y / z)) tmp = 0.0 if ((x <= -2.05e-79) || !(x <= 112.0)) tmp = Float64(x / t_0); else tmp = Float64(y / t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - (y / z); tmp = 0.0; if ((x <= -2.05e-79) || ~((x <= 112.0))) tmp = x / t_0; else tmp = y / t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x, -2.05e-79], N[Not[LessEqual[x, 112.0]], $MachinePrecision]], N[(x / t$95$0), $MachinePrecision], N[(y / t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{y}{z}\\
\mathbf{if}\;x \leq -2.05 \cdot 10^{-79} \lor \neg \left(x \leq 112\right):\\
\;\;\;\;\frac{x}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t\_0}\\
\end{array}
\end{array}
if x < -2.04999999999999997e-79 or 112 < x Initial program 87.5%
Taylor expanded in x around inf 77.3%
if -2.04999999999999997e-79 < x < 112Initial program 87.3%
Taylor expanded in x around 0 73.0%
Final simplification75.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.65e+52) (not (<= y 1.35e+108))) (- z) (+ x y)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.65e+52) || !(y <= 1.35e+108)) {
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.65d+52)) .or. (.not. (y <= 1.35d+108))) 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.65e+52) || !(y <= 1.35e+108)) {
tmp = -z;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.65e+52) or not (y <= 1.35e+108): tmp = -z else: tmp = x + y return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.65e+52) || !(y <= 1.35e+108)) 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.65e+52) || ~((y <= 1.35e+108))) tmp = -z; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.65e+52], N[Not[LessEqual[y, 1.35e+108]], $MachinePrecision]], (-z), N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{+52} \lor \neg \left(y \leq 1.35 \cdot 10^{+108}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if y < -1.65e52 or 1.35e108 < y Initial program 65.0%
Taylor expanded in y around inf 68.6%
mul-1-neg68.6%
Simplified68.6%
if -1.65e52 < y < 1.35e108Initial program 99.3%
Taylor expanded in z around inf 71.2%
+-commutative71.2%
Simplified71.2%
Final simplification70.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.4e+48) (not (<= y 4.7e-26))) (- z) x))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.4e+48) || !(y <= 4.7e-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 <= (-2.4d+48)) .or. (.not. (y <= 4.7d-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 <= -2.4e+48) || !(y <= 4.7e-26)) {
tmp = -z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.4e+48) or not (y <= 4.7e-26): tmp = -z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.4e+48) || !(y <= 4.7e-26)) tmp = Float64(-z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.4e+48) || ~((y <= 4.7e-26))) tmp = -z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.4e+48], N[Not[LessEqual[y, 4.7e-26]], $MachinePrecision]], (-z), x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{+48} \lor \neg \left(y \leq 4.7 \cdot 10^{-26}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.4000000000000001e48 or 4.69999999999999989e-26 < y Initial program 72.8%
Taylor expanded in y around inf 59.9%
mul-1-neg59.9%
Simplified59.9%
if -2.4000000000000001e48 < y < 4.69999999999999989e-26Initial program 99.9%
Taylor expanded in y around 0 60.0%
Final simplification60.0%
(FPCore (x y z) :precision binary64 (if (<= x -4.2e-81) x (if (<= x 2.5e-144) y x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.2e-81) {
tmp = x;
} else if (x <= 2.5e-144) {
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 <= (-4.2d-81)) then
tmp = x
else if (x <= 2.5d-144) 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 <= -4.2e-81) {
tmp = x;
} else if (x <= 2.5e-144) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4.2e-81: tmp = x elif x <= 2.5e-144: tmp = y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4.2e-81) tmp = x; elseif (x <= 2.5e-144) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4.2e-81) tmp = x; elseif (x <= 2.5e-144) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4.2e-81], x, If[LessEqual[x, 2.5e-144], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{-81}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-144}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -4.1999999999999998e-81 or 2.4999999999999999e-144 < x Initial program 87.3%
Taylor expanded in y around 0 48.0%
if -4.1999999999999998e-81 < x < 2.4999999999999999e-144Initial program 87.6%
Taylor expanded in x around 0 78.6%
Taylor expanded in y around 0 46.2%
Final simplification47.4%
(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 36.2%
Final simplification36.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 2024027
(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))))