
(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 9 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 (if (or (<= y -3.25e+63) (not (<= y 2e-23))) (* z (/ (+ y x) (- z y))) (/ (+ y x) (- 1.0 (/ y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.25e+63) || !(y <= 2e-23)) {
tmp = z * ((y + x) / (z - y));
} else {
tmp = (y + 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 <= (-3.25d+63)) .or. (.not. (y <= 2d-23))) then
tmp = z * ((y + x) / (z - y))
else
tmp = (y + 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 <= -3.25e+63) || !(y <= 2e-23)) {
tmp = z * ((y + x) / (z - y));
} else {
tmp = (y + x) / (1.0 - (y / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.25e+63) or not (y <= 2e-23): tmp = z * ((y + x) / (z - y)) else: tmp = (y + x) / (1.0 - (y / z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.25e+63) || !(y <= 2e-23)) tmp = Float64(z * Float64(Float64(y + x) / Float64(z - y))); else tmp = Float64(Float64(y + x) / Float64(1.0 - Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3.25e+63) || ~((y <= 2e-23))) tmp = z * ((y + x) / (z - y)); else tmp = (y + x) / (1.0 - (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.25e+63], N[Not[LessEqual[y, 2e-23]], $MachinePrecision]], N[(z * N[(N[(y + x), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y + x), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.25 \cdot 10^{+63} \lor \neg \left(y \leq 2 \cdot 10^{-23}\right):\\
\;\;\;\;z \cdot \frac{y + x}{z - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{y + x}{1 - \frac{y}{z}}\\
\end{array}
\end{array}
if y < -3.24999999999999996e63 or 1.99999999999999992e-23 < y Initial program 71.3%
Taylor expanded in z around 0 71.3%
associate-/r/99.9%
Applied egg-rr99.9%
if -3.24999999999999996e63 < y < 1.99999999999999992e-23Initial program 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (- -1.0 (/ x y)))))
(if (<= y -4.7e+52)
t_0
(if (<= y -4.4e-8)
(+ y x)
(if (<= y -2.2e-34)
t_0
(if (<= y 1.85e-211)
(* x (/ z (- z y)))
(if (<= y 0.0064) (+ y x) t_0)))))))
double code(double x, double y, double z) {
double t_0 = z * (-1.0 - (x / y));
double tmp;
if (y <= -4.7e+52) {
tmp = t_0;
} else if (y <= -4.4e-8) {
tmp = y + x;
} else if (y <= -2.2e-34) {
tmp = t_0;
} else if (y <= 1.85e-211) {
tmp = x * (z / (z - y));
} else if (y <= 0.0064) {
tmp = y + x;
} 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 * ((-1.0d0) - (x / y))
if (y <= (-4.7d+52)) then
tmp = t_0
else if (y <= (-4.4d-8)) then
tmp = y + x
else if (y <= (-2.2d-34)) then
tmp = t_0
else if (y <= 1.85d-211) then
tmp = x * (z / (z - y))
else if (y <= 0.0064d0) then
tmp = y + x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (-1.0 - (x / y));
double tmp;
if (y <= -4.7e+52) {
tmp = t_0;
} else if (y <= -4.4e-8) {
tmp = y + x;
} else if (y <= -2.2e-34) {
tmp = t_0;
} else if (y <= 1.85e-211) {
tmp = x * (z / (z - y));
} else if (y <= 0.0064) {
tmp = y + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (-1.0 - (x / y)) tmp = 0 if y <= -4.7e+52: tmp = t_0 elif y <= -4.4e-8: tmp = y + x elif y <= -2.2e-34: tmp = t_0 elif y <= 1.85e-211: tmp = x * (z / (z - y)) elif y <= 0.0064: tmp = y + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(-1.0 - Float64(x / y))) tmp = 0.0 if (y <= -4.7e+52) tmp = t_0; elseif (y <= -4.4e-8) tmp = Float64(y + x); elseif (y <= -2.2e-34) tmp = t_0; elseif (y <= 1.85e-211) tmp = Float64(x * Float64(z / Float64(z - y))); elseif (y <= 0.0064) tmp = Float64(y + x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (-1.0 - (x / y)); tmp = 0.0; if (y <= -4.7e+52) tmp = t_0; elseif (y <= -4.4e-8) tmp = y + x; elseif (y <= -2.2e-34) tmp = t_0; elseif (y <= 1.85e-211) tmp = x * (z / (z - y)); elseif (y <= 0.0064) tmp = y + x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.7e+52], t$95$0, If[LessEqual[y, -4.4e-8], N[(y + x), $MachinePrecision], If[LessEqual[y, -2.2e-34], t$95$0, If[LessEqual[y, 1.85e-211], N[(x * N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.0064], N[(y + x), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(-1 - \frac{x}{y}\right)\\
\mathbf{if}\;y \leq -4.7 \cdot 10^{+52}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -4.4 \cdot 10^{-8}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;y \leq -2.2 \cdot 10^{-34}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{-211}:\\
\;\;\;\;x \cdot \frac{z}{z - y}\\
\mathbf{elif}\;y \leq 0.0064:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -4.7e52 or -4.3999999999999997e-8 < y < -2.1999999999999999e-34 or 0.00640000000000000031 < y Initial program 71.8%
Taylor expanded in y around inf 66.7%
Simplified77.0%
Taylor expanded in z around 0 81.6%
sub-neg81.6%
metadata-eval81.6%
metadata-eval81.6%
distribute-lft-in81.6%
+-commutative81.6%
distribute-lft-in81.6%
metadata-eval81.6%
neg-mul-181.6%
sub-neg81.6%
Simplified81.6%
if -4.7e52 < y < -4.3999999999999997e-8 or 1.8499999999999999e-211 < y < 0.00640000000000000031Initial program 99.9%
Taylor expanded in z around inf 76.2%
+-commutative76.2%
Simplified76.2%
if -2.1999999999999999e-34 < y < 1.8499999999999999e-211Initial program 99.9%
Taylor expanded in z around 0 99.8%
Taylor expanded in x around inf 72.3%
associate-/l*86.7%
Simplified86.7%
Final simplification82.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (- -1.0 (/ x y)))))
(if (<= y -6e+52)
t_0
(if (<= y -1.05e-6)
(+ y x)
(if (<= y -3.8e-35)
t_0
(if (<= y 2.1e-210)
(/ x (- 1.0 (/ y z)))
(if (<= y 0.68) (+ y x) t_0)))))))
double code(double x, double y, double z) {
double t_0 = z * (-1.0 - (x / y));
double tmp;
if (y <= -6e+52) {
tmp = t_0;
} else if (y <= -1.05e-6) {
tmp = y + x;
} else if (y <= -3.8e-35) {
tmp = t_0;
} else if (y <= 2.1e-210) {
tmp = x / (1.0 - (y / z));
} else if (y <= 0.68) {
tmp = y + x;
} 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 * ((-1.0d0) - (x / y))
if (y <= (-6d+52)) then
tmp = t_0
else if (y <= (-1.05d-6)) then
tmp = y + x
else if (y <= (-3.8d-35)) then
tmp = t_0
else if (y <= 2.1d-210) then
tmp = x / (1.0d0 - (y / z))
else if (y <= 0.68d0) then
tmp = y + x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (-1.0 - (x / y));
double tmp;
if (y <= -6e+52) {
tmp = t_0;
} else if (y <= -1.05e-6) {
tmp = y + x;
} else if (y <= -3.8e-35) {
tmp = t_0;
} else if (y <= 2.1e-210) {
tmp = x / (1.0 - (y / z));
} else if (y <= 0.68) {
tmp = y + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (-1.0 - (x / y)) tmp = 0 if y <= -6e+52: tmp = t_0 elif y <= -1.05e-6: tmp = y + x elif y <= -3.8e-35: tmp = t_0 elif y <= 2.1e-210: tmp = x / (1.0 - (y / z)) elif y <= 0.68: tmp = y + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(-1.0 - Float64(x / y))) tmp = 0.0 if (y <= -6e+52) tmp = t_0; elseif (y <= -1.05e-6) tmp = Float64(y + x); elseif (y <= -3.8e-35) tmp = t_0; elseif (y <= 2.1e-210) tmp = Float64(x / Float64(1.0 - Float64(y / z))); elseif (y <= 0.68) tmp = Float64(y + x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (-1.0 - (x / y)); tmp = 0.0; if (y <= -6e+52) tmp = t_0; elseif (y <= -1.05e-6) tmp = y + x; elseif (y <= -3.8e-35) tmp = t_0; elseif (y <= 2.1e-210) tmp = x / (1.0 - (y / z)); elseif (y <= 0.68) tmp = y + x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6e+52], t$95$0, If[LessEqual[y, -1.05e-6], N[(y + x), $MachinePrecision], If[LessEqual[y, -3.8e-35], t$95$0, If[LessEqual[y, 2.1e-210], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.68], N[(y + x), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(-1 - \frac{x}{y}\right)\\
\mathbf{if}\;y \leq -6 \cdot 10^{+52}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -1.05 \cdot 10^{-6}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;y \leq -3.8 \cdot 10^{-35}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{-210}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\
\mathbf{elif}\;y \leq 0.68:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -6e52 or -1.0499999999999999e-6 < y < -3.8000000000000001e-35 or 0.680000000000000049 < y Initial program 71.8%
Taylor expanded in y around inf 66.7%
Simplified77.0%
Taylor expanded in z around 0 81.6%
sub-neg81.6%
metadata-eval81.6%
metadata-eval81.6%
distribute-lft-in81.6%
+-commutative81.6%
distribute-lft-in81.6%
metadata-eval81.6%
neg-mul-181.6%
sub-neg81.6%
Simplified81.6%
if -6e52 < y < -1.0499999999999999e-6 or 2.10000000000000016e-210 < y < 0.680000000000000049Initial program 99.9%
Taylor expanded in z around inf 76.2%
+-commutative76.2%
Simplified76.2%
if -3.8000000000000001e-35 < y < 2.10000000000000016e-210Initial program 99.9%
Taylor expanded in x around inf 86.8%
Final simplification82.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (/ z (- z y)))))
(if (<= y -7.6e+52)
(- z)
(if (<= y 2.3e-211)
t_0
(if (<= y 3.3e-87) (+ y x) (if (<= y 1.9e+54) t_0 (- z)))))))
double code(double x, double y, double z) {
double t_0 = x * (z / (z - y));
double tmp;
if (y <= -7.6e+52) {
tmp = -z;
} else if (y <= 2.3e-211) {
tmp = t_0;
} else if (y <= 3.3e-87) {
tmp = y + x;
} else if (y <= 1.9e+54) {
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 * (z / (z - y))
if (y <= (-7.6d+52)) then
tmp = -z
else if (y <= 2.3d-211) then
tmp = t_0
else if (y <= 3.3d-87) then
tmp = y + x
else if (y <= 1.9d+54) 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 * (z / (z - y));
double tmp;
if (y <= -7.6e+52) {
tmp = -z;
} else if (y <= 2.3e-211) {
tmp = t_0;
} else if (y <= 3.3e-87) {
tmp = y + x;
} else if (y <= 1.9e+54) {
tmp = t_0;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): t_0 = x * (z / (z - y)) tmp = 0 if y <= -7.6e+52: tmp = -z elif y <= 2.3e-211: tmp = t_0 elif y <= 3.3e-87: tmp = y + x elif y <= 1.9e+54: tmp = t_0 else: tmp = -z return tmp
function code(x, y, z) t_0 = Float64(x * Float64(z / Float64(z - y))) tmp = 0.0 if (y <= -7.6e+52) tmp = Float64(-z); elseif (y <= 2.3e-211) tmp = t_0; elseif (y <= 3.3e-87) tmp = Float64(y + x); elseif (y <= 1.9e+54) tmp = t_0; else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (z / (z - y)); tmp = 0.0; if (y <= -7.6e+52) tmp = -z; elseif (y <= 2.3e-211) tmp = t_0; elseif (y <= 3.3e-87) tmp = y + x; elseif (y <= 1.9e+54) tmp = t_0; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7.6e+52], (-z), If[LessEqual[y, 2.3e-211], t$95$0, If[LessEqual[y, 3.3e-87], N[(y + x), $MachinePrecision], If[LessEqual[y, 1.9e+54], t$95$0, (-z)]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{z}{z - y}\\
\mathbf{if}\;y \leq -7.6 \cdot 10^{+52}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{-211}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{-87}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+54}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -7.5999999999999999e52 or 1.9000000000000001e54 < y Initial program 69.1%
Taylor expanded in y around inf 68.8%
mul-1-neg68.8%
Simplified68.8%
if -7.5999999999999999e52 < y < 2.29999999999999988e-211 or 3.3e-87 < y < 1.9000000000000001e54Initial program 99.2%
Taylor expanded in z around 0 99.2%
Taylor expanded in x around inf 62.5%
associate-/l*78.5%
Simplified78.5%
if 2.29999999999999988e-211 < y < 3.3e-87Initial program 99.9%
Taylor expanded in z around inf 81.0%
+-commutative81.0%
Simplified81.0%
Final simplification75.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -1e-126) (not (<= y 5.4e-242))) (* z (/ (+ y x) (- z y))) (/ x (- 1.0 (/ y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1e-126) || !(y <= 5.4e-242)) {
tmp = z * ((y + 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 <= (-1d-126)) .or. (.not. (y <= 5.4d-242))) then
tmp = z * ((y + 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 <= -1e-126) || !(y <= 5.4e-242)) {
tmp = z * ((y + x) / (z - y));
} else {
tmp = x / (1.0 - (y / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1e-126) or not (y <= 5.4e-242): tmp = z * ((y + x) / (z - y)) else: tmp = x / (1.0 - (y / z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1e-126) || !(y <= 5.4e-242)) tmp = Float64(z * Float64(Float64(y + 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 <= -1e-126) || ~((y <= 5.4e-242))) tmp = z * ((y + x) / (z - y)); else tmp = x / (1.0 - (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1e-126], N[Not[LessEqual[y, 5.4e-242]], $MachinePrecision]], N[(z * N[(N[(y + x), $MachinePrecision] / 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 -1 \cdot 10^{-126} \lor \neg \left(y \leq 5.4 \cdot 10^{-242}\right):\\
\;\;\;\;z \cdot \frac{y + x}{z - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\
\end{array}
\end{array}
if y < -9.9999999999999995e-127 or 5.4e-242 < y Initial program 83.4%
Taylor expanded in z around 0 83.4%
associate-/r/95.5%
Applied egg-rr95.5%
if -9.9999999999999995e-127 < y < 5.4e-242Initial program 99.9%
Taylor expanded in x around inf 93.9%
Final simplification95.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.8e+55) (not (<= y 2.1e+53))) (- z) (+ y x)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.8e+55) || !(y <= 2.1e+53)) {
tmp = -z;
} else {
tmp = 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) :: tmp
if ((y <= (-1.8d+55)) .or. (.not. (y <= 2.1d+53))) then
tmp = -z
else
tmp = y + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.8e+55) || !(y <= 2.1e+53)) {
tmp = -z;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.8e+55) or not (y <= 2.1e+53): tmp = -z else: tmp = y + x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.8e+55) || !(y <= 2.1e+53)) tmp = Float64(-z); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.8e+55) || ~((y <= 2.1e+53))) tmp = -z; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.8e+55], N[Not[LessEqual[y, 2.1e+53]], $MachinePrecision]], (-z), N[(y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{+55} \lor \neg \left(y \leq 2.1 \cdot 10^{+53}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if y < -1.79999999999999994e55 or 2.1000000000000002e53 < y Initial program 68.5%
Taylor expanded in y around inf 68.2%
mul-1-neg68.2%
Simplified68.2%
if -1.79999999999999994e55 < y < 2.1000000000000002e53Initial program 99.9%
Taylor expanded in z around inf 72.5%
+-commutative72.5%
Simplified72.5%
Final simplification70.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.9e+54) (not (<= y 2.8e+53))) (- z) x))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.9e+54) || !(y <= 2.8e+53)) {
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 <= (-3.9d+54)) .or. (.not. (y <= 2.8d+53))) 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 <= -3.9e+54) || !(y <= 2.8e+53)) {
tmp = -z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.9e+54) or not (y <= 2.8e+53): tmp = -z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.9e+54) || !(y <= 2.8e+53)) tmp = Float64(-z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3.9e+54) || ~((y <= 2.8e+53))) tmp = -z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.9e+54], N[Not[LessEqual[y, 2.8e+53]], $MachinePrecision]], (-z), x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.9 \cdot 10^{+54} \lor \neg \left(y \leq 2.8 \cdot 10^{+53}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -3.9000000000000003e54 or 2.8e53 < y Initial program 68.5%
Taylor expanded in y around inf 68.2%
mul-1-neg68.2%
Simplified68.2%
if -3.9000000000000003e54 < y < 2.8e53Initial program 99.9%
Taylor expanded in y around 0 57.8%
Final simplification61.9%
(FPCore (x y z) :precision binary64 (if (<= x -1.32e-211) x (if (<= x 5e-113) y x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.32e-211) {
tmp = x;
} else if (x <= 5e-113) {
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 <= (-1.32d-211)) then
tmp = x
else if (x <= 5d-113) 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 <= -1.32e-211) {
tmp = x;
} else if (x <= 5e-113) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.32e-211: tmp = x elif x <= 5e-113: tmp = y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.32e-211) tmp = x; elseif (x <= 5e-113) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.32e-211) tmp = x; elseif (x <= 5e-113) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.32e-211], x, If[LessEqual[x, 5e-113], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.32 \cdot 10^{-211}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-113}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.3200000000000001e-211 or 4.9999999999999997e-113 < x Initial program 86.8%
Taylor expanded in y around 0 44.5%
if -1.3200000000000001e-211 < x < 4.9999999999999997e-113Initial program 89.3%
Taylor expanded in x around 0 75.4%
Taylor expanded in y around 0 40.8%
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.4%
Taylor expanded in y around 0 37.8%
Final simplification37.8%
(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 2024077
(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))))