
(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 (let* ((t_0 (/ (+ x y) (- 1.0 (/ y z))))) (if (or (<= t_0 -1e-261) (not (<= t_0 0.0))) t_0 (* z (- -1.0 (/ x y))))))
double code(double x, double y, double z) {
double t_0 = (x + y) / (1.0 - (y / z));
double tmp;
if ((t_0 <= -1e-261) || !(t_0 <= 0.0)) {
tmp = t_0;
} else {
tmp = z * (-1.0 - (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 <= (-1d-261)) .or. (.not. (t_0 <= 0.0d0))) then
tmp = t_0
else
tmp = z * ((-1.0d0) - (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 <= -1e-261) || !(t_0 <= 0.0)) {
tmp = t_0;
} else {
tmp = z * (-1.0 - (x / y));
}
return tmp;
}
def code(x, y, z): t_0 = (x + y) / (1.0 - (y / z)) tmp = 0 if (t_0 <= -1e-261) or not (t_0 <= 0.0): tmp = t_0 else: tmp = z * (-1.0 - (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 <= -1e-261) || !(t_0 <= 0.0)) tmp = t_0; else tmp = Float64(z * Float64(-1.0 - 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 <= -1e-261) || ~((t_0 <= 0.0))) tmp = t_0; else tmp = z * (-1.0 - (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, -1e-261], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], t$95$0, N[(z * N[(-1.0 - 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 -1 \cdot 10^{-261} \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -9.99999999999999984e-262 or 0.0 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) Initial program 99.9%
if -9.99999999999999984e-262 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 0.0Initial program 16.8%
Taylor expanded in z around 0 96.1%
mul-1-neg96.1%
associate-/l*99.9%
distribute-rgt-neg-in99.9%
distribute-neg-frac299.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 96.1%
associate-*r/99.9%
associate-*r*99.9%
mul-1-neg99.9%
*-lft-identity99.9%
associate-*l/99.7%
distribute-rgt-in99.7%
rgt-mult-inverse99.9%
associate-*r/99.9%
*-rgt-identity99.9%
+-commutative99.9%
distribute-rgt-in99.8%
*-lft-identity99.8%
mul-1-neg99.8%
distribute-rgt-neg-in99.8%
distribute-lft-neg-in99.8%
mul-1-neg99.8%
distribute-rgt-in99.9%
mul-1-neg99.9%
unsub-neg99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (- -1.0 (/ x y)))))
(if (<= y -1.2e+71)
t_0
(if (<= y -1e-71)
(+ x y)
(if (<= y -1.35e-210)
(/ x (- 1.0 (/ y z)))
(if (or (<= y 1350.0) (and (not (<= y 3.6e+59)) (<= y 4e+116)))
(+ x y)
t_0))))))
double code(double x, double y, double z) {
double t_0 = z * (-1.0 - (x / y));
double tmp;
if (y <= -1.2e+71) {
tmp = t_0;
} else if (y <= -1e-71) {
tmp = x + y;
} else if (y <= -1.35e-210) {
tmp = x / (1.0 - (y / z));
} else if ((y <= 1350.0) || (!(y <= 3.6e+59) && (y <= 4e+116))) {
tmp = x + y;
} 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 <= (-1.2d+71)) then
tmp = t_0
else if (y <= (-1d-71)) then
tmp = x + y
else if (y <= (-1.35d-210)) then
tmp = x / (1.0d0 - (y / z))
else if ((y <= 1350.0d0) .or. (.not. (y <= 3.6d+59)) .and. (y <= 4d+116)) then
tmp = x + y
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 <= -1.2e+71) {
tmp = t_0;
} else if (y <= -1e-71) {
tmp = x + y;
} else if (y <= -1.35e-210) {
tmp = x / (1.0 - (y / z));
} else if ((y <= 1350.0) || (!(y <= 3.6e+59) && (y <= 4e+116))) {
tmp = x + y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (-1.0 - (x / y)) tmp = 0 if y <= -1.2e+71: tmp = t_0 elif y <= -1e-71: tmp = x + y elif y <= -1.35e-210: tmp = x / (1.0 - (y / z)) elif (y <= 1350.0) or (not (y <= 3.6e+59) and (y <= 4e+116)): tmp = x + y 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 <= -1.2e+71) tmp = t_0; elseif (y <= -1e-71) tmp = Float64(x + y); elseif (y <= -1.35e-210) tmp = Float64(x / Float64(1.0 - Float64(y / z))); elseif ((y <= 1350.0) || (!(y <= 3.6e+59) && (y <= 4e+116))) tmp = Float64(x + y); 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 <= -1.2e+71) tmp = t_0; elseif (y <= -1e-71) tmp = x + y; elseif (y <= -1.35e-210) tmp = x / (1.0 - (y / z)); elseif ((y <= 1350.0) || (~((y <= 3.6e+59)) && (y <= 4e+116))) tmp = x + y; 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, -1.2e+71], t$95$0, If[LessEqual[y, -1e-71], N[(x + y), $MachinePrecision], If[LessEqual[y, -1.35e-210], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 1350.0], And[N[Not[LessEqual[y, 3.6e+59]], $MachinePrecision], LessEqual[y, 4e+116]]], N[(x + y), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(-1 - \frac{x}{y}\right)\\
\mathbf{if}\;y \leq -1.2 \cdot 10^{+71}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -1 \cdot 10^{-71}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq -1.35 \cdot 10^{-210}:\\
\;\;\;\;\frac{x}{1 - \frac{y}{z}}\\
\mathbf{elif}\;y \leq 1350 \lor \neg \left(y \leq 3.6 \cdot 10^{+59}\right) \land y \leq 4 \cdot 10^{+116}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.1999999999999999e71 or 1350 < y < 3.5999999999999999e59 or 4.00000000000000006e116 < y Initial program 78.1%
Taylor expanded in z around 0 58.3%
mul-1-neg58.3%
associate-/l*78.5%
distribute-rgt-neg-in78.5%
distribute-neg-frac278.5%
+-commutative78.5%
Simplified78.5%
Taylor expanded in z around 0 58.3%
associate-*r/78.5%
associate-*r*78.5%
mul-1-neg78.5%
*-lft-identity78.5%
associate-*l/78.4%
distribute-rgt-in78.4%
rgt-mult-inverse78.5%
associate-*r/78.5%
*-rgt-identity78.5%
+-commutative78.5%
distribute-rgt-in78.5%
*-lft-identity78.5%
mul-1-neg78.5%
distribute-rgt-neg-in78.5%
distribute-lft-neg-in78.5%
mul-1-neg78.5%
distribute-rgt-in78.5%
mul-1-neg78.5%
unsub-neg78.5%
Simplified78.5%
if -1.1999999999999999e71 < y < -9.9999999999999992e-72 or -1.34999999999999996e-210 < y < 1350 or 3.5999999999999999e59 < y < 4.00000000000000006e116Initial program 99.2%
Taylor expanded in z around inf 79.7%
+-commutative79.7%
Simplified79.7%
if -9.9999999999999992e-72 < y < -1.34999999999999996e-210Initial program 99.8%
Taylor expanded in x around inf 77.4%
Final simplification79.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (/ y z))) (t_1 (* z (- -1.0 (/ x y)))))
(if (<= y -6.4e+93)
t_1
(if (<= y -7.5e-42)
(/ y t_0)
(if (<= y -3.5e-211)
(/ x t_0)
(if (or (<= y 36000.0) (and (not (<= y 1.5e+59)) (<= y 4.2e+116)))
(+ x y)
t_1))))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (y / z);
double t_1 = z * (-1.0 - (x / y));
double tmp;
if (y <= -6.4e+93) {
tmp = t_1;
} else if (y <= -7.5e-42) {
tmp = y / t_0;
} else if (y <= -3.5e-211) {
tmp = x / t_0;
} else if ((y <= 36000.0) || (!(y <= 1.5e+59) && (y <= 4.2e+116))) {
tmp = x + y;
} else {
tmp = t_1;
}
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 = z * ((-1.0d0) - (x / y))
if (y <= (-6.4d+93)) then
tmp = t_1
else if (y <= (-7.5d-42)) then
tmp = y / t_0
else if (y <= (-3.5d-211)) then
tmp = x / t_0
else if ((y <= 36000.0d0) .or. (.not. (y <= 1.5d+59)) .and. (y <= 4.2d+116)) then
tmp = x + y
else
tmp = t_1
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 = z * (-1.0 - (x / y));
double tmp;
if (y <= -6.4e+93) {
tmp = t_1;
} else if (y <= -7.5e-42) {
tmp = y / t_0;
} else if (y <= -3.5e-211) {
tmp = x / t_0;
} else if ((y <= 36000.0) || (!(y <= 1.5e+59) && (y <= 4.2e+116))) {
tmp = x + y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (y / z) t_1 = z * (-1.0 - (x / y)) tmp = 0 if y <= -6.4e+93: tmp = t_1 elif y <= -7.5e-42: tmp = y / t_0 elif y <= -3.5e-211: tmp = x / t_0 elif (y <= 36000.0) or (not (y <= 1.5e+59) and (y <= 4.2e+116)): tmp = x + y else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(y / z)) t_1 = Float64(z * Float64(-1.0 - Float64(x / y))) tmp = 0.0 if (y <= -6.4e+93) tmp = t_1; elseif (y <= -7.5e-42) tmp = Float64(y / t_0); elseif (y <= -3.5e-211) tmp = Float64(x / t_0); elseif ((y <= 36000.0) || (!(y <= 1.5e+59) && (y <= 4.2e+116))) tmp = Float64(x + y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - (y / z); t_1 = z * (-1.0 - (x / y)); tmp = 0.0; if (y <= -6.4e+93) tmp = t_1; elseif (y <= -7.5e-42) tmp = y / t_0; elseif (y <= -3.5e-211) tmp = x / t_0; elseif ((y <= 36000.0) || (~((y <= 1.5e+59)) && (y <= 4.2e+116))) tmp = x + y; else tmp = t_1; 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[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.4e+93], t$95$1, If[LessEqual[y, -7.5e-42], N[(y / t$95$0), $MachinePrecision], If[LessEqual[y, -3.5e-211], N[(x / t$95$0), $MachinePrecision], If[Or[LessEqual[y, 36000.0], And[N[Not[LessEqual[y, 1.5e+59]], $MachinePrecision], LessEqual[y, 4.2e+116]]], N[(x + y), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{y}{z}\\
t_1 := z \cdot \left(-1 - \frac{x}{y}\right)\\
\mathbf{if}\;y \leq -6.4 \cdot 10^{+93}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -7.5 \cdot 10^{-42}:\\
\;\;\;\;\frac{y}{t\_0}\\
\mathbf{elif}\;y \leq -3.5 \cdot 10^{-211}:\\
\;\;\;\;\frac{x}{t\_0}\\
\mathbf{elif}\;y \leq 36000 \lor \neg \left(y \leq 1.5 \cdot 10^{+59}\right) \land y \leq 4.2 \cdot 10^{+116}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -6.4000000000000003e93 or 36000 < y < 1.5e59 or 4.2000000000000002e116 < y Initial program 77.4%
Taylor expanded in z around 0 57.3%
mul-1-neg57.3%
associate-/l*79.0%
distribute-rgt-neg-in79.0%
distribute-neg-frac279.0%
+-commutative79.0%
Simplified79.0%
Taylor expanded in z around 0 57.3%
associate-*r/79.0%
associate-*r*79.0%
mul-1-neg79.0%
*-lft-identity79.0%
associate-*l/78.9%
distribute-rgt-in78.9%
rgt-mult-inverse79.0%
associate-*r/79.0%
*-rgt-identity79.0%
+-commutative79.0%
distribute-rgt-in79.0%
*-lft-identity79.0%
mul-1-neg79.0%
distribute-rgt-neg-in79.0%
distribute-lft-neg-in79.0%
mul-1-neg79.0%
distribute-rgt-in79.0%
mul-1-neg79.0%
unsub-neg79.0%
Simplified79.0%
if -6.4000000000000003e93 < y < -7.49999999999999972e-42Initial program 97.5%
Taylor expanded in x around 0 71.0%
if -7.49999999999999972e-42 < y < -3.5e-211Initial program 99.9%
Taylor expanded in x around inf 75.9%
if -3.5e-211 < y < 36000 or 1.5e59 < y < 4.2000000000000002e116Initial program 98.9%
Taylor expanded in z around inf 84.1%
+-commutative84.1%
Simplified84.1%
Final simplification79.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (/ y z))))
(if (<= y -5.8e+93)
(* z (/ (+ x y) (- y)))
(if (<= y -1.8e-41)
(/ y t_0)
(if (<= y -3.1e-212)
(/ x t_0)
(if (or (<= y 225.0) (and (not (<= y 2.5e+56)) (<= y 8e+120)))
(+ x y)
(* z (- -1.0 (/ x y)))))))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (y / z);
double tmp;
if (y <= -5.8e+93) {
tmp = z * ((x + y) / -y);
} else if (y <= -1.8e-41) {
tmp = y / t_0;
} else if (y <= -3.1e-212) {
tmp = x / t_0;
} else if ((y <= 225.0) || (!(y <= 2.5e+56) && (y <= 8e+120))) {
tmp = x + y;
} else {
tmp = z * (-1.0 - (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 = 1.0d0 - (y / z)
if (y <= (-5.8d+93)) then
tmp = z * ((x + y) / -y)
else if (y <= (-1.8d-41)) then
tmp = y / t_0
else if (y <= (-3.1d-212)) then
tmp = x / t_0
else if ((y <= 225.0d0) .or. (.not. (y <= 2.5d+56)) .and. (y <= 8d+120)) then
tmp = x + y
else
tmp = z * ((-1.0d0) - (x / y))
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 <= -5.8e+93) {
tmp = z * ((x + y) / -y);
} else if (y <= -1.8e-41) {
tmp = y / t_0;
} else if (y <= -3.1e-212) {
tmp = x / t_0;
} else if ((y <= 225.0) || (!(y <= 2.5e+56) && (y <= 8e+120))) {
tmp = x + y;
} else {
tmp = z * (-1.0 - (x / y));
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (y / z) tmp = 0 if y <= -5.8e+93: tmp = z * ((x + y) / -y) elif y <= -1.8e-41: tmp = y / t_0 elif y <= -3.1e-212: tmp = x / t_0 elif (y <= 225.0) or (not (y <= 2.5e+56) and (y <= 8e+120)): tmp = x + y else: tmp = z * (-1.0 - (x / y)) return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(y / z)) tmp = 0.0 if (y <= -5.8e+93) tmp = Float64(z * Float64(Float64(x + y) / Float64(-y))); elseif (y <= -1.8e-41) tmp = Float64(y / t_0); elseif (y <= -3.1e-212) tmp = Float64(x / t_0); elseif ((y <= 225.0) || (!(y <= 2.5e+56) && (y <= 8e+120))) tmp = Float64(x + y); else tmp = Float64(z * Float64(-1.0 - Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - (y / z); tmp = 0.0; if (y <= -5.8e+93) tmp = z * ((x + y) / -y); elseif (y <= -1.8e-41) tmp = y / t_0; elseif (y <= -3.1e-212) tmp = x / t_0; elseif ((y <= 225.0) || (~((y <= 2.5e+56)) && (y <= 8e+120))) tmp = x + y; else tmp = z * (-1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.8e+93], N[(z * N[(N[(x + y), $MachinePrecision] / (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.8e-41], N[(y / t$95$0), $MachinePrecision], If[LessEqual[y, -3.1e-212], N[(x / t$95$0), $MachinePrecision], If[Or[LessEqual[y, 225.0], And[N[Not[LessEqual[y, 2.5e+56]], $MachinePrecision], LessEqual[y, 8e+120]]], N[(x + y), $MachinePrecision], N[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{y}{z}\\
\mathbf{if}\;y \leq -5.8 \cdot 10^{+93}:\\
\;\;\;\;z \cdot \frac{x + y}{-y}\\
\mathbf{elif}\;y \leq -1.8 \cdot 10^{-41}:\\
\;\;\;\;\frac{y}{t\_0}\\
\mathbf{elif}\;y \leq -3.1 \cdot 10^{-212}:\\
\;\;\;\;\frac{x}{t\_0}\\
\mathbf{elif}\;y \leq 225 \lor \neg \left(y \leq 2.5 \cdot 10^{+56}\right) \land y \leq 8 \cdot 10^{+120}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if y < -5.7999999999999997e93Initial program 80.6%
Taylor expanded in z around 0 54.2%
mul-1-neg54.2%
associate-/l*79.3%
distribute-rgt-neg-in79.3%
distribute-neg-frac279.3%
+-commutative79.3%
Simplified79.3%
if -5.7999999999999997e93 < y < -1.8e-41Initial program 97.5%
Taylor expanded in x around 0 71.0%
if -1.8e-41 < y < -3.10000000000000006e-212Initial program 99.9%
Taylor expanded in x around inf 75.9%
if -3.10000000000000006e-212 < y < 225 or 2.50000000000000012e56 < y < 7.9999999999999998e120Initial program 98.9%
Taylor expanded in z around inf 84.1%
+-commutative84.1%
Simplified84.1%
if 225 < y < 2.50000000000000012e56 or 7.9999999999999998e120 < y Initial program 73.8%
Taylor expanded in z around 0 60.8%
mul-1-neg60.8%
associate-/l*78.7%
distribute-rgt-neg-in78.7%
distribute-neg-frac278.7%
+-commutative78.7%
Simplified78.7%
Taylor expanded in z around 0 60.8%
associate-*r/78.7%
associate-*r*78.7%
mul-1-neg78.7%
*-lft-identity78.7%
associate-*l/78.7%
distribute-rgt-in78.7%
rgt-mult-inverse78.8%
associate-*r/78.7%
*-rgt-identity78.7%
+-commutative78.7%
distribute-rgt-in78.7%
*-lft-identity78.7%
mul-1-neg78.7%
distribute-rgt-neg-in78.7%
distribute-lft-neg-in78.7%
mul-1-neg78.7%
distribute-rgt-in78.7%
mul-1-neg78.7%
unsub-neg78.7%
Simplified78.7%
Final simplification79.2%
(FPCore (x y z)
:precision binary64
(if (or (<= y -7.2e+71)
(and (not (<= y 15500.0)) (or (<= y 3.6e+58) (not (<= y 2.9e+119)))))
(* z (- -1.0 (/ x y)))
(+ x y)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -7.2e+71) || (!(y <= 15500.0) && ((y <= 3.6e+58) || !(y <= 2.9e+119)))) {
tmp = z * (-1.0 - (x / y));
} else {
tmp = x + y;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-7.2d+71)) .or. (.not. (y <= 15500.0d0)) .and. (y <= 3.6d+58) .or. (.not. (y <= 2.9d+119))) then
tmp = z * ((-1.0d0) - (x / y))
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -7.2e+71) || (!(y <= 15500.0) && ((y <= 3.6e+58) || !(y <= 2.9e+119)))) {
tmp = z * (-1.0 - (x / y));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -7.2e+71) or (not (y <= 15500.0) and ((y <= 3.6e+58) or not (y <= 2.9e+119))): tmp = z * (-1.0 - (x / y)) else: tmp = x + y return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -7.2e+71) || (!(y <= 15500.0) && ((y <= 3.6e+58) || !(y <= 2.9e+119)))) tmp = Float64(z * Float64(-1.0 - Float64(x / y))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -7.2e+71) || (~((y <= 15500.0)) && ((y <= 3.6e+58) || ~((y <= 2.9e+119))))) tmp = z * (-1.0 - (x / y)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -7.2e+71], And[N[Not[LessEqual[y, 15500.0]], $MachinePrecision], Or[LessEqual[y, 3.6e+58], N[Not[LessEqual[y, 2.9e+119]], $MachinePrecision]]]], N[(z * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{+71} \lor \neg \left(y \leq 15500\right) \land \left(y \leq 3.6 \cdot 10^{+58} \lor \neg \left(y \leq 2.9 \cdot 10^{+119}\right)\right):\\
\;\;\;\;z \cdot \left(-1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if y < -7.1999999999999999e71 or 15500 < y < 3.59999999999999996e58 or 2.90000000000000007e119 < y Initial program 78.1%
Taylor expanded in z around 0 58.3%
mul-1-neg58.3%
associate-/l*78.5%
distribute-rgt-neg-in78.5%
distribute-neg-frac278.5%
+-commutative78.5%
Simplified78.5%
Taylor expanded in z around 0 58.3%
associate-*r/78.5%
associate-*r*78.5%
mul-1-neg78.5%
*-lft-identity78.5%
associate-*l/78.4%
distribute-rgt-in78.4%
rgt-mult-inverse78.5%
associate-*r/78.5%
*-rgt-identity78.5%
+-commutative78.5%
distribute-rgt-in78.5%
*-lft-identity78.5%
mul-1-neg78.5%
distribute-rgt-neg-in78.5%
distribute-lft-neg-in78.5%
mul-1-neg78.5%
distribute-rgt-in78.5%
mul-1-neg78.5%
unsub-neg78.5%
Simplified78.5%
if -7.1999999999999999e71 < y < 15500 or 3.59999999999999996e58 < y < 2.90000000000000007e119Initial program 99.3%
Taylor expanded in z around inf 76.7%
+-commutative76.7%
Simplified76.7%
Final simplification77.4%
(FPCore (x y z) :precision binary64 (if (<= y -2e+67) (- z) (if (<= y -1.75e-40) y (if (<= y 10000.0) x (- z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2e+67) {
tmp = -z;
} else if (y <= -1.75e-40) {
tmp = y;
} else if (y <= 10000.0) {
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 <= (-2d+67)) then
tmp = -z
else if (y <= (-1.75d-40)) then
tmp = y
else if (y <= 10000.0d0) 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 <= -2e+67) {
tmp = -z;
} else if (y <= -1.75e-40) {
tmp = y;
} else if (y <= 10000.0) {
tmp = x;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2e+67: tmp = -z elif y <= -1.75e-40: tmp = y elif y <= 10000.0: tmp = x else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2e+67) tmp = Float64(-z); elseif (y <= -1.75e-40) tmp = y; elseif (y <= 10000.0) tmp = x; else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2e+67) tmp = -z; elseif (y <= -1.75e-40) tmp = y; elseif (y <= 10000.0) tmp = x; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2e+67], (-z), If[LessEqual[y, -1.75e-40], y, If[LessEqual[y, 10000.0], x, (-z)]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{+67}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq -1.75 \cdot 10^{-40}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 10000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -1.99999999999999997e67 or 1e4 < y Initial program 80.3%
Taylor expanded in y around inf 56.0%
mul-1-neg56.0%
Simplified56.0%
if -1.99999999999999997e67 < y < -1.7500000000000001e-40Initial program 99.8%
Taylor expanded in x around 0 73.0%
Taylor expanded in y around 0 47.4%
if -1.7500000000000001e-40 < y < 1e4Initial program 99.9%
Taylor expanded in y around 0 66.6%
Final simplification59.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.6e+74) (not (<= y 5.8e+139))) (- z) (+ x y)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.6e+74) || !(y <= 5.8e+139)) {
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 <= (-2.6d+74)) .or. (.not. (y <= 5.8d+139))) 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 <= -2.6e+74) || !(y <= 5.8e+139)) {
tmp = -z;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.6e+74) or not (y <= 5.8e+139): tmp = -z else: tmp = x + y return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.6e+74) || !(y <= 5.8e+139)) tmp = Float64(-z); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.6e+74) || ~((y <= 5.8e+139))) tmp = -z; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.6e+74], N[Not[LessEqual[y, 5.8e+139]], $MachinePrecision]], (-z), N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{+74} \lor \neg \left(y \leq 5.8 \cdot 10^{+139}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if y < -2.6000000000000001e74 or 5.7999999999999998e139 < y Initial program 76.1%
Taylor expanded in y around inf 65.9%
mul-1-neg65.9%
Simplified65.9%
if -2.6000000000000001e74 < y < 5.7999999999999998e139Initial program 98.3%
Taylor expanded in z around inf 72.7%
+-commutative72.7%
Simplified72.7%
Final simplification70.5%
(FPCore (x y z) :precision binary64 (if (<= x -3.3e-134) x (if (<= x 2.3e-68) y x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.3e-134) {
tmp = x;
} else if (x <= 2.3e-68) {
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 <= (-3.3d-134)) then
tmp = x
else if (x <= 2.3d-68) 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 <= -3.3e-134) {
tmp = x;
} else if (x <= 2.3e-68) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.3e-134: tmp = x elif x <= 2.3e-68: tmp = y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.3e-134) tmp = x; elseif (x <= 2.3e-68) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.3e-134) tmp = x; elseif (x <= 2.3e-68) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.3e-134], x, If[LessEqual[x, 2.3e-68], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.3 \cdot 10^{-134}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-68}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.30000000000000019e-134 or 2.29999999999999997e-68 < x Initial program 90.2%
Taylor expanded in y around 0 49.1%
if -3.30000000000000019e-134 < x < 2.29999999999999997e-68Initial program 92.8%
Taylor expanded in x around 0 78.6%
Taylor expanded in y around 0 38.5%
Final simplification45.3%
(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 91.1%
Taylor expanded in y around 0 36.5%
Final simplification36.5%
(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 2024067
(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))))