
(FPCore (x y z) :precision binary64 (/ (+ x y) (- 1.0 (/ y z))))
double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + y) / (1.0d0 - (y / z))
end function
public static double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
def code(x, y, z): return (x + y) / (1.0 - (y / z))
function code(x, y, z) return Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))) end
function tmp = code(x, y, z) tmp = (x + y) / (1.0 - (y / z)); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y}{1 - \frac{y}{z}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (+ x y) (- 1.0 (/ y z))))
double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + y) / (1.0d0 - (y / z))
end function
public static double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
def code(x, y, z): return (x + y) / (1.0 - (y / z))
function code(x, y, z) return Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))) end
function tmp = code(x, y, z) tmp = (x + y) / (1.0 - (y / z)); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y}{1 - \frac{y}{z}}
\end{array}
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (+ x y) (- 1.0 (/ y z))))) (if (or (<= t_0 -2e-249) (not (<= t_0 0.0))) t_0 (/ (- z) (/ y (+ x y))))))
double code(double x, double y, double z) {
double t_0 = (x + y) / (1.0 - (y / z));
double tmp;
if ((t_0 <= -2e-249) || !(t_0 <= 0.0)) {
tmp = t_0;
} else {
tmp = -z / (y / (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 <= (-2d-249)) .or. (.not. (t_0 <= 0.0d0))) then
tmp = t_0
else
tmp = -z / (y / (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 <= -2e-249) || !(t_0 <= 0.0)) {
tmp = t_0;
} else {
tmp = -z / (y / (x + y));
}
return tmp;
}
def code(x, y, z): t_0 = (x + y) / (1.0 - (y / z)) tmp = 0 if (t_0 <= -2e-249) or not (t_0 <= 0.0): tmp = t_0 else: tmp = -z / (y / (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 <= -2e-249) || !(t_0 <= 0.0)) tmp = t_0; else tmp = Float64(Float64(-z) / Float64(y / 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 <= -2e-249) || ~((t_0 <= 0.0))) tmp = t_0; else tmp = -z / (y / (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, -2e-249], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], t$95$0, N[((-z) / N[(y / 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 -2 \cdot 10^{-249} \lor \neg \left(t_0 \leq 0\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{-z}{\frac{y}{x + y}}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) < -2.00000000000000011e-249 or 0.0 < (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) Initial program 99.8%
if -2.00000000000000011e-249 < (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) < 0.0Initial program 11.2%
Taylor expanded in z around 0 97.3%
mul-1-neg97.3%
associate-/l*100.0%
distribute-neg-frac100.0%
+-commutative100.0%
Simplified100.0%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ 1.0 (- (/ 1.0 y) (/ 1.0 z)))) (t_1 (/ x (- 1.0 (/ y z)))))
(if (<= y -2.2e+90)
t_0
(if (<= y -29000000.0)
(/ (* z (- (+ x y))) y)
(if (<= y -2.9e-19)
(+ x y)
(if (<= y -4.3e-98)
t_1
(if (<= y -5.8e-239)
(+ x y)
(if (<= y 2400000.0)
t_1
(if (or (<= y 2.6e+90) (not (<= y 1.95e+237)))
t_0
(/ (- z) (/ y (+ x y))))))))))))
double code(double x, double y, double z) {
double t_0 = 1.0 / ((1.0 / y) - (1.0 / z));
double t_1 = x / (1.0 - (y / z));
double tmp;
if (y <= -2.2e+90) {
tmp = t_0;
} else if (y <= -29000000.0) {
tmp = (z * -(x + y)) / y;
} else if (y <= -2.9e-19) {
tmp = x + y;
} else if (y <= -4.3e-98) {
tmp = t_1;
} else if (y <= -5.8e-239) {
tmp = x + y;
} else if (y <= 2400000.0) {
tmp = t_1;
} else if ((y <= 2.6e+90) || !(y <= 1.95e+237)) {
tmp = t_0;
} else {
tmp = -z / (y / (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) :: t_1
real(8) :: tmp
t_0 = 1.0d0 / ((1.0d0 / y) - (1.0d0 / z))
t_1 = x / (1.0d0 - (y / z))
if (y <= (-2.2d+90)) then
tmp = t_0
else if (y <= (-29000000.0d0)) then
tmp = (z * -(x + y)) / y
else if (y <= (-2.9d-19)) then
tmp = x + y
else if (y <= (-4.3d-98)) then
tmp = t_1
else if (y <= (-5.8d-239)) then
tmp = x + y
else if (y <= 2400000.0d0) then
tmp = t_1
else if ((y <= 2.6d+90) .or. (.not. (y <= 1.95d+237))) then
tmp = t_0
else
tmp = -z / (y / (x + y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 / ((1.0 / y) - (1.0 / z));
double t_1 = x / (1.0 - (y / z));
double tmp;
if (y <= -2.2e+90) {
tmp = t_0;
} else if (y <= -29000000.0) {
tmp = (z * -(x + y)) / y;
} else if (y <= -2.9e-19) {
tmp = x + y;
} else if (y <= -4.3e-98) {
tmp = t_1;
} else if (y <= -5.8e-239) {
tmp = x + y;
} else if (y <= 2400000.0) {
tmp = t_1;
} else if ((y <= 2.6e+90) || !(y <= 1.95e+237)) {
tmp = t_0;
} else {
tmp = -z / (y / (x + y));
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 / ((1.0 / y) - (1.0 / z)) t_1 = x / (1.0 - (y / z)) tmp = 0 if y <= -2.2e+90: tmp = t_0 elif y <= -29000000.0: tmp = (z * -(x + y)) / y elif y <= -2.9e-19: tmp = x + y elif y <= -4.3e-98: tmp = t_1 elif y <= -5.8e-239: tmp = x + y elif y <= 2400000.0: tmp = t_1 elif (y <= 2.6e+90) or not (y <= 1.95e+237): tmp = t_0 else: tmp = -z / (y / (x + y)) return tmp
function code(x, y, z) t_0 = Float64(1.0 / Float64(Float64(1.0 / y) - Float64(1.0 / z))) t_1 = Float64(x / Float64(1.0 - Float64(y / z))) tmp = 0.0 if (y <= -2.2e+90) tmp = t_0; elseif (y <= -29000000.0) tmp = Float64(Float64(z * Float64(-Float64(x + y))) / y); elseif (y <= -2.9e-19) tmp = Float64(x + y); elseif (y <= -4.3e-98) tmp = t_1; elseif (y <= -5.8e-239) tmp = Float64(x + y); elseif (y <= 2400000.0) tmp = t_1; elseif ((y <= 2.6e+90) || !(y <= 1.95e+237)) tmp = t_0; else tmp = Float64(Float64(-z) / Float64(y / Float64(x + y))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 / ((1.0 / y) - (1.0 / z)); t_1 = x / (1.0 - (y / z)); tmp = 0.0; if (y <= -2.2e+90) tmp = t_0; elseif (y <= -29000000.0) tmp = (z * -(x + y)) / y; elseif (y <= -2.9e-19) tmp = x + y; elseif (y <= -4.3e-98) tmp = t_1; elseif (y <= -5.8e-239) tmp = x + y; elseif (y <= 2400000.0) tmp = t_1; elseif ((y <= 2.6e+90) || ~((y <= 1.95e+237))) tmp = t_0; else tmp = -z / (y / (x + y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 / N[(N[(1.0 / y), $MachinePrecision] - N[(1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.2e+90], t$95$0, If[LessEqual[y, -29000000.0], N[(N[(z * (-N[(x + y), $MachinePrecision])), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, -2.9e-19], N[(x + y), $MachinePrecision], If[LessEqual[y, -4.3e-98], t$95$1, If[LessEqual[y, -5.8e-239], N[(x + y), $MachinePrecision], If[LessEqual[y, 2400000.0], t$95$1, If[Or[LessEqual[y, 2.6e+90], N[Not[LessEqual[y, 1.95e+237]], $MachinePrecision]], t$95$0, N[((-z) / N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\frac{1}{y} - \frac{1}{z}}\\
t_1 := \frac{x}{1 - \frac{y}{z}}\\
\mathbf{if}\;y \leq -2.2 \cdot 10^{+90}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -29000000:\\
\;\;\;\;\frac{z \cdot \left(-\left(x + y\right)\right)}{y}\\
\mathbf{elif}\;y \leq -2.9 \cdot 10^{-19}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq -4.3 \cdot 10^{-98}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-239}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 2400000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+90} \lor \neg \left(y \leq 1.95 \cdot 10^{+237}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{-z}{\frac{y}{x + y}}\\
\end{array}
\end{array}
if y < -2.1999999999999999e90 or 2.4e6 < y < 2.5999999999999998e90 or 1.9500000000000001e237 < y Initial program 78.7%
clear-num78.6%
associate-/r/78.6%
Applied egg-rr78.6%
associate-/r/78.6%
+-commutative78.6%
Applied egg-rr78.6%
Taylor expanded in z around 0 75.4%
Taylor expanded in x around 0 87.7%
if -2.1999999999999999e90 < y < -2.9e7Initial program 94.7%
Taylor expanded in z around 0 74.4%
if -2.9e7 < y < -2.9e-19 or -4.29999999999999988e-98 < y < -5.8000000000000004e-239Initial program 99.9%
Taylor expanded in z around inf 88.3%
+-commutative88.3%
Simplified88.3%
if -2.9e-19 < y < -4.29999999999999988e-98 or -5.8000000000000004e-239 < y < 2.4e6Initial program 99.8%
Taylor expanded in x around inf 80.7%
if 2.5999999999999998e90 < y < 1.9500000000000001e237Initial program 69.1%
Taylor expanded in z around 0 87.4%
mul-1-neg87.4%
associate-/l*93.8%
distribute-neg-frac93.8%
+-commutative93.8%
Simplified93.8%
Final simplification85.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (/ y z))) (t_1 (/ x t_0)) (t_2 (/ y t_0)))
(if (<= y -4.2e+191)
(- z)
(if (<= y -1e+82)
t_2
(if (<= y -5.3e+72)
t_1
(if (<= y -0.00186)
t_2
(if (<= y -3.8e-96)
t_1
(if (<= y -1.95e-238)
(+ x y)
(if (<= y 1150000.0) t_1 (if (<= y 2.25e+92) t_2 (- z)))))))))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (y / z);
double t_1 = x / t_0;
double t_2 = y / t_0;
double tmp;
if (y <= -4.2e+191) {
tmp = -z;
} else if (y <= -1e+82) {
tmp = t_2;
} else if (y <= -5.3e+72) {
tmp = t_1;
} else if (y <= -0.00186) {
tmp = t_2;
} else if (y <= -3.8e-96) {
tmp = t_1;
} else if (y <= -1.95e-238) {
tmp = x + y;
} else if (y <= 1150000.0) {
tmp = t_1;
} else if (y <= 2.25e+92) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_0 = 1.0d0 - (y / z)
t_1 = x / t_0
t_2 = y / t_0
if (y <= (-4.2d+191)) then
tmp = -z
else if (y <= (-1d+82)) then
tmp = t_2
else if (y <= (-5.3d+72)) then
tmp = t_1
else if (y <= (-0.00186d0)) then
tmp = t_2
else if (y <= (-3.8d-96)) then
tmp = t_1
else if (y <= (-1.95d-238)) then
tmp = x + y
else if (y <= 1150000.0d0) then
tmp = t_1
else if (y <= 2.25d+92) then
tmp = t_2
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 = x / t_0;
double t_2 = y / t_0;
double tmp;
if (y <= -4.2e+191) {
tmp = -z;
} else if (y <= -1e+82) {
tmp = t_2;
} else if (y <= -5.3e+72) {
tmp = t_1;
} else if (y <= -0.00186) {
tmp = t_2;
} else if (y <= -3.8e-96) {
tmp = t_1;
} else if (y <= -1.95e-238) {
tmp = x + y;
} else if (y <= 1150000.0) {
tmp = t_1;
} else if (y <= 2.25e+92) {
tmp = t_2;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (y / z) t_1 = x / t_0 t_2 = y / t_0 tmp = 0 if y <= -4.2e+191: tmp = -z elif y <= -1e+82: tmp = t_2 elif y <= -5.3e+72: tmp = t_1 elif y <= -0.00186: tmp = t_2 elif y <= -3.8e-96: tmp = t_1 elif y <= -1.95e-238: tmp = x + y elif y <= 1150000.0: tmp = t_1 elif y <= 2.25e+92: tmp = t_2 else: tmp = -z return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(y / z)) t_1 = Float64(x / t_0) t_2 = Float64(y / t_0) tmp = 0.0 if (y <= -4.2e+191) tmp = Float64(-z); elseif (y <= -1e+82) tmp = t_2; elseif (y <= -5.3e+72) tmp = t_1; elseif (y <= -0.00186) tmp = t_2; elseif (y <= -3.8e-96) tmp = t_1; elseif (y <= -1.95e-238) tmp = Float64(x + y); elseif (y <= 1150000.0) tmp = t_1; elseif (y <= 2.25e+92) tmp = t_2; else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - (y / z); t_1 = x / t_0; t_2 = y / t_0; tmp = 0.0; if (y <= -4.2e+191) tmp = -z; elseif (y <= -1e+82) tmp = t_2; elseif (y <= -5.3e+72) tmp = t_1; elseif (y <= -0.00186) tmp = t_2; elseif (y <= -3.8e-96) tmp = t_1; elseif (y <= -1.95e-238) tmp = x + y; elseif (y <= 1150000.0) tmp = t_1; elseif (y <= 2.25e+92) tmp = t_2; 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[(x / t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(y / t$95$0), $MachinePrecision]}, If[LessEqual[y, -4.2e+191], (-z), If[LessEqual[y, -1e+82], t$95$2, If[LessEqual[y, -5.3e+72], t$95$1, If[LessEqual[y, -0.00186], t$95$2, If[LessEqual[y, -3.8e-96], t$95$1, If[LessEqual[y, -1.95e-238], N[(x + y), $MachinePrecision], If[LessEqual[y, 1150000.0], t$95$1, If[LessEqual[y, 2.25e+92], t$95$2, (-z)]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{y}{z}\\
t_1 := \frac{x}{t_0}\\
t_2 := \frac{y}{t_0}\\
\mathbf{if}\;y \leq -4.2 \cdot 10^{+191}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq -1 \cdot 10^{+82}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -5.3 \cdot 10^{+72}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -0.00186:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -3.8 \cdot 10^{-96}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.95 \cdot 10^{-238}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 1150000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.25 \cdot 10^{+92}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -4.2000000000000001e191 or 2.25e92 < y Initial program 65.9%
Taylor expanded in y around inf 84.7%
mul-1-neg84.7%
Simplified84.7%
if -4.2000000000000001e191 < y < -9.9999999999999996e81 or -5.3000000000000003e72 < y < -0.0018600000000000001 or 1.15e6 < y < 2.25e92Initial program 95.0%
Taylor expanded in x around 0 73.0%
if -9.9999999999999996e81 < y < -5.3000000000000003e72 or -0.0018600000000000001 < y < -3.8000000000000001e-96 or -1.9499999999999999e-238 < y < 1.15e6Initial program 99.8%
Taylor expanded in x around inf 80.9%
if -3.8000000000000001e-96 < y < -1.9499999999999999e-238Initial program 99.9%
Taylor expanded in z around inf 88.8%
+-commutative88.8%
Simplified88.8%
Final simplification81.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (/ y z))) (t_1 (/ y t_0)) (t_2 (/ x t_0)))
(if (<= y -3.8e+192)
(- z)
(if (<= y -6e+87)
t_1
(if (<= y -48000000.0)
(* (+ x y) (- (/ z y)))
(if (<= y -2.3e-19)
(+ x y)
(if (<= y -4.6e-96)
t_2
(if (<= y -5e-238)
(+ x y)
(if (<= y 440000.0) t_2 (if (<= y 4.6e+92) 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 t_2 = x / t_0;
double tmp;
if (y <= -3.8e+192) {
tmp = -z;
} else if (y <= -6e+87) {
tmp = t_1;
} else if (y <= -48000000.0) {
tmp = (x + y) * -(z / y);
} else if (y <= -2.3e-19) {
tmp = x + y;
} else if (y <= -4.6e-96) {
tmp = t_2;
} else if (y <= -5e-238) {
tmp = x + y;
} else if (y <= 440000.0) {
tmp = t_2;
} else if (y <= 4.6e+92) {
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) :: t_2
real(8) :: tmp
t_0 = 1.0d0 - (y / z)
t_1 = y / t_0
t_2 = x / t_0
if (y <= (-3.8d+192)) then
tmp = -z
else if (y <= (-6d+87)) then
tmp = t_1
else if (y <= (-48000000.0d0)) then
tmp = (x + y) * -(z / y)
else if (y <= (-2.3d-19)) then
tmp = x + y
else if (y <= (-4.6d-96)) then
tmp = t_2
else if (y <= (-5d-238)) then
tmp = x + y
else if (y <= 440000.0d0) then
tmp = t_2
else if (y <= 4.6d+92) 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 t_2 = x / t_0;
double tmp;
if (y <= -3.8e+192) {
tmp = -z;
} else if (y <= -6e+87) {
tmp = t_1;
} else if (y <= -48000000.0) {
tmp = (x + y) * -(z / y);
} else if (y <= -2.3e-19) {
tmp = x + y;
} else if (y <= -4.6e-96) {
tmp = t_2;
} else if (y <= -5e-238) {
tmp = x + y;
} else if (y <= 440000.0) {
tmp = t_2;
} else if (y <= 4.6e+92) {
tmp = t_1;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (y / z) t_1 = y / t_0 t_2 = x / t_0 tmp = 0 if y <= -3.8e+192: tmp = -z elif y <= -6e+87: tmp = t_1 elif y <= -48000000.0: tmp = (x + y) * -(z / y) elif y <= -2.3e-19: tmp = x + y elif y <= -4.6e-96: tmp = t_2 elif y <= -5e-238: tmp = x + y elif y <= 440000.0: tmp = t_2 elif y <= 4.6e+92: 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) t_2 = Float64(x / t_0) tmp = 0.0 if (y <= -3.8e+192) tmp = Float64(-z); elseif (y <= -6e+87) tmp = t_1; elseif (y <= -48000000.0) tmp = Float64(Float64(x + y) * Float64(-Float64(z / y))); elseif (y <= -2.3e-19) tmp = Float64(x + y); elseif (y <= -4.6e-96) tmp = t_2; elseif (y <= -5e-238) tmp = Float64(x + y); elseif (y <= 440000.0) tmp = t_2; elseif (y <= 4.6e+92) 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; t_2 = x / t_0; tmp = 0.0; if (y <= -3.8e+192) tmp = -z; elseif (y <= -6e+87) tmp = t_1; elseif (y <= -48000000.0) tmp = (x + y) * -(z / y); elseif (y <= -2.3e-19) tmp = x + y; elseif (y <= -4.6e-96) tmp = t_2; elseif (y <= -5e-238) tmp = x + y; elseif (y <= 440000.0) tmp = t_2; elseif (y <= 4.6e+92) 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]}, Block[{t$95$2 = N[(x / t$95$0), $MachinePrecision]}, If[LessEqual[y, -3.8e+192], (-z), If[LessEqual[y, -6e+87], t$95$1, If[LessEqual[y, -48000000.0], N[(N[(x + y), $MachinePrecision] * (-N[(z / y), $MachinePrecision])), $MachinePrecision], If[LessEqual[y, -2.3e-19], N[(x + y), $MachinePrecision], If[LessEqual[y, -4.6e-96], t$95$2, If[LessEqual[y, -5e-238], N[(x + y), $MachinePrecision], If[LessEqual[y, 440000.0], t$95$2, If[LessEqual[y, 4.6e+92], t$95$1, (-z)]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{y}{z}\\
t_1 := \frac{y}{t_0}\\
t_2 := \frac{x}{t_0}\\
\mathbf{if}\;y \leq -3.8 \cdot 10^{+192}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq -6 \cdot 10^{+87}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -48000000:\\
\;\;\;\;\left(x + y\right) \cdot \left(-\frac{z}{y}\right)\\
\mathbf{elif}\;y \leq -2.3 \cdot 10^{-19}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq -4.6 \cdot 10^{-96}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -5 \cdot 10^{-238}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 440000:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{+92}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -3.7999999999999999e192 or 4.59999999999999997e92 < y Initial program 65.9%
Taylor expanded in y around inf 84.7%
mul-1-neg84.7%
Simplified84.7%
if -3.7999999999999999e192 < y < -5.9999999999999998e87 or 4.4e5 < y < 4.59999999999999997e92Initial program 93.5%
Taylor expanded in x around 0 73.5%
if -5.9999999999999998e87 < y < -4.8e7Initial program 99.7%
Taylor expanded in z around 0 75.5%
mul-1-neg75.5%
associate-/l*75.4%
associate-/r/75.6%
distribute-rgt-neg-in75.6%
+-commutative75.6%
distribute-neg-in75.6%
sub-neg75.6%
Simplified75.6%
if -4.8e7 < y < -2.2999999999999998e-19 or -4.6e-96 < y < -5e-238Initial program 99.9%
Taylor expanded in z around inf 88.3%
+-commutative88.3%
Simplified88.3%
if -2.2999999999999998e-19 < y < -4.6e-96 or -5e-238 < y < 4.4e5Initial program 99.8%
Taylor expanded in x around inf 80.7%
Final simplification81.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (- z) (/ y (+ x y)))) (t_1 (- 1.0 (/ y z))))
(if (<= y -0.007)
t_0
(if (<= y -8e-20)
(+ x y)
(if (<= y -2.1e-79)
(* (+ x y) (- (/ z y)))
(if (<= y -2.3e-238)
(+ x y)
(if (<= y 195000.0)
(/ x t_1)
(if (<= y 6.8e+86) (/ y t_1) t_0))))))))
double code(double x, double y, double z) {
double t_0 = -z / (y / (x + y));
double t_1 = 1.0 - (y / z);
double tmp;
if (y <= -0.007) {
tmp = t_0;
} else if (y <= -8e-20) {
tmp = x + y;
} else if (y <= -2.1e-79) {
tmp = (x + y) * -(z / y);
} else if (y <= -2.3e-238) {
tmp = x + y;
} else if (y <= 195000.0) {
tmp = x / t_1;
} else if (y <= 6.8e+86) {
tmp = y / t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = -z / (y / (x + y))
t_1 = 1.0d0 - (y / z)
if (y <= (-0.007d0)) then
tmp = t_0
else if (y <= (-8d-20)) then
tmp = x + y
else if (y <= (-2.1d-79)) then
tmp = (x + y) * -(z / y)
else if (y <= (-2.3d-238)) then
tmp = x + y
else if (y <= 195000.0d0) then
tmp = x / t_1
else if (y <= 6.8d+86) then
tmp = y / t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -z / (y / (x + y));
double t_1 = 1.0 - (y / z);
double tmp;
if (y <= -0.007) {
tmp = t_0;
} else if (y <= -8e-20) {
tmp = x + y;
} else if (y <= -2.1e-79) {
tmp = (x + y) * -(z / y);
} else if (y <= -2.3e-238) {
tmp = x + y;
} else if (y <= 195000.0) {
tmp = x / t_1;
} else if (y <= 6.8e+86) {
tmp = y / t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -z / (y / (x + y)) t_1 = 1.0 - (y / z) tmp = 0 if y <= -0.007: tmp = t_0 elif y <= -8e-20: tmp = x + y elif y <= -2.1e-79: tmp = (x + y) * -(z / y) elif y <= -2.3e-238: tmp = x + y elif y <= 195000.0: tmp = x / t_1 elif y <= 6.8e+86: tmp = y / t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(-z) / Float64(y / Float64(x + y))) t_1 = Float64(1.0 - Float64(y / z)) tmp = 0.0 if (y <= -0.007) tmp = t_0; elseif (y <= -8e-20) tmp = Float64(x + y); elseif (y <= -2.1e-79) tmp = Float64(Float64(x + y) * Float64(-Float64(z / y))); elseif (y <= -2.3e-238) tmp = Float64(x + y); elseif (y <= 195000.0) tmp = Float64(x / t_1); elseif (y <= 6.8e+86) tmp = Float64(y / t_1); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -z / (y / (x + y)); t_1 = 1.0 - (y / z); tmp = 0.0; if (y <= -0.007) tmp = t_0; elseif (y <= -8e-20) tmp = x + y; elseif (y <= -2.1e-79) tmp = (x + y) * -(z / y); elseif (y <= -2.3e-238) tmp = x + y; elseif (y <= 195000.0) tmp = x / t_1; elseif (y <= 6.8e+86) tmp = y / t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[((-z) / N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.007], t$95$0, If[LessEqual[y, -8e-20], N[(x + y), $MachinePrecision], If[LessEqual[y, -2.1e-79], N[(N[(x + y), $MachinePrecision] * (-N[(z / y), $MachinePrecision])), $MachinePrecision], If[LessEqual[y, -2.3e-238], N[(x + y), $MachinePrecision], If[LessEqual[y, 195000.0], N[(x / t$95$1), $MachinePrecision], If[LessEqual[y, 6.8e+86], N[(y / t$95$1), $MachinePrecision], t$95$0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-z}{\frac{y}{x + y}}\\
t_1 := 1 - \frac{y}{z}\\
\mathbf{if}\;y \leq -0.007:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -8 \cdot 10^{-20}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq -2.1 \cdot 10^{-79}:\\
\;\;\;\;\left(x + y\right) \cdot \left(-\frac{z}{y}\right)\\
\mathbf{elif}\;y \leq -2.3 \cdot 10^{-238}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 195000:\\
\;\;\;\;\frac{x}{t_1}\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{+86}:\\
\;\;\;\;\frac{y}{t_1}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -0.00700000000000000015 or 6.7999999999999995e86 < y Initial program 76.6%
Taylor expanded in z around 0 64.1%
mul-1-neg64.1%
associate-/l*82.0%
distribute-neg-frac82.0%
+-commutative82.0%
Simplified82.0%
if -0.00700000000000000015 < y < -7.99999999999999956e-20 or -2.0999999999999999e-79 < y < -2.30000000000000005e-238Initial program 100.0%
Taylor expanded in z around inf 87.9%
+-commutative87.9%
Simplified87.9%
if -7.99999999999999956e-20 < y < -2.0999999999999999e-79Initial program 99.5%
Taylor expanded in z around 0 71.3%
mul-1-neg71.3%
associate-/l*61.4%
associate-/r/71.3%
distribute-rgt-neg-in71.3%
+-commutative71.3%
distribute-neg-in71.3%
sub-neg71.3%
Simplified71.3%
if -2.30000000000000005e-238 < y < 195000Initial program 99.8%
Taylor expanded in x around inf 81.5%
if 195000 < y < 6.7999999999999995e86Initial program 99.8%
Taylor expanded in x around 0 81.2%
Final simplification82.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ x (- 1.0 (/ y z)))))
(if (<= y -1.05e+153)
(- z)
(if (<= y -3.4e+84)
(+ x y)
(if (<= y -5.7e-98)
t_0
(if (<= y -5.8e-239)
(+ x y)
(if (<= y 8e-13) t_0 (if (<= y 4.2e+86) (+ x y) (- z)))))))))
double code(double x, double y, double z) {
double t_0 = x / (1.0 - (y / z));
double tmp;
if (y <= -1.05e+153) {
tmp = -z;
} else if (y <= -3.4e+84) {
tmp = x + y;
} else if (y <= -5.7e-98) {
tmp = t_0;
} else if (y <= -5.8e-239) {
tmp = x + y;
} else if (y <= 8e-13) {
tmp = t_0;
} else if (y <= 4.2e+86) {
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) :: t_0
real(8) :: tmp
t_0 = x / (1.0d0 - (y / z))
if (y <= (-1.05d+153)) then
tmp = -z
else if (y <= (-3.4d+84)) then
tmp = x + y
else if (y <= (-5.7d-98)) then
tmp = t_0
else if (y <= (-5.8d-239)) then
tmp = x + y
else if (y <= 8d-13) then
tmp = t_0
else if (y <= 4.2d+86) then
tmp = x + y
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 <= -1.05e+153) {
tmp = -z;
} else if (y <= -3.4e+84) {
tmp = x + y;
} else if (y <= -5.7e-98) {
tmp = t_0;
} else if (y <= -5.8e-239) {
tmp = x + y;
} else if (y <= 8e-13) {
tmp = t_0;
} else if (y <= 4.2e+86) {
tmp = x + y;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): t_0 = x / (1.0 - (y / z)) tmp = 0 if y <= -1.05e+153: tmp = -z elif y <= -3.4e+84: tmp = x + y elif y <= -5.7e-98: tmp = t_0 elif y <= -5.8e-239: tmp = x + y elif y <= 8e-13: tmp = t_0 elif y <= 4.2e+86: tmp = x + y 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 <= -1.05e+153) tmp = Float64(-z); elseif (y <= -3.4e+84) tmp = Float64(x + y); elseif (y <= -5.7e-98) tmp = t_0; elseif (y <= -5.8e-239) tmp = Float64(x + y); elseif (y <= 8e-13) tmp = t_0; elseif (y <= 4.2e+86) tmp = Float64(x + y); 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 <= -1.05e+153) tmp = -z; elseif (y <= -3.4e+84) tmp = x + y; elseif (y <= -5.7e-98) tmp = t_0; elseif (y <= -5.8e-239) tmp = x + y; elseif (y <= 8e-13) tmp = t_0; elseif (y <= 4.2e+86) tmp = x + y; 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, -1.05e+153], (-z), If[LessEqual[y, -3.4e+84], N[(x + y), $MachinePrecision], If[LessEqual[y, -5.7e-98], t$95$0, If[LessEqual[y, -5.8e-239], N[(x + y), $MachinePrecision], If[LessEqual[y, 8e-13], t$95$0, If[LessEqual[y, 4.2e+86], N[(x + y), $MachinePrecision], (-z)]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{1 - \frac{y}{z}}\\
\mathbf{if}\;y \leq -1.05 \cdot 10^{+153}:\\
\;\;\;\;-z\\
\mathbf{elif}\;y \leq -3.4 \cdot 10^{+84}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq -5.7 \cdot 10^{-98}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-239}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;y \leq 8 \cdot 10^{-13}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{+86}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if y < -1.05000000000000008e153 or 4.1999999999999998e86 < y Initial program 70.1%
Taylor expanded in y around inf 81.7%
mul-1-neg81.7%
Simplified81.7%
if -1.05000000000000008e153 < y < -3.3999999999999998e84 or -5.6999999999999998e-98 < y < -5.8000000000000004e-239 or 8.0000000000000002e-13 < y < 4.1999999999999998e86Initial program 95.5%
Taylor expanded in z around inf 73.0%
+-commutative73.0%
Simplified73.0%
if -3.3999999999999998e84 < y < -5.6999999999999998e-98 or -5.8000000000000004e-239 < y < 8.0000000000000002e-13Initial program 99.8%
Taylor expanded in x around inf 74.3%
Final simplification76.5%
(FPCore (x y z)
:precision binary64
(if (or (<= y -1.05e+153)
(not (or (<= y -4.6e+71) (and (not (<= y -1.4e+23)) (<= y 7.5e+89)))))
(- z)
(+ x y)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.05e+153) || !((y <= -4.6e+71) || (!(y <= -1.4e+23) && (y <= 7.5e+89)))) {
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.05d+153)) .or. (.not. (y <= (-4.6d+71)) .or. (.not. (y <= (-1.4d+23))) .and. (y <= 7.5d+89))) 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.05e+153) || !((y <= -4.6e+71) || (!(y <= -1.4e+23) && (y <= 7.5e+89)))) {
tmp = -z;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.05e+153) or not ((y <= -4.6e+71) or (not (y <= -1.4e+23) and (y <= 7.5e+89))): tmp = -z else: tmp = x + y return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.05e+153) || !((y <= -4.6e+71) || (!(y <= -1.4e+23) && (y <= 7.5e+89)))) 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.05e+153) || ~(((y <= -4.6e+71) || (~((y <= -1.4e+23)) && (y <= 7.5e+89))))) tmp = -z; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.05e+153], N[Not[Or[LessEqual[y, -4.6e+71], And[N[Not[LessEqual[y, -1.4e+23]], $MachinePrecision], LessEqual[y, 7.5e+89]]]], $MachinePrecision]], (-z), N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{+153} \lor \neg \left(y \leq -4.6 \cdot 10^{+71} \lor \neg \left(y \leq -1.4 \cdot 10^{+23}\right) \land y \leq 7.5 \cdot 10^{+89}\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if y < -1.05000000000000008e153 or -4.6000000000000005e71 < y < -1.4e23 or 7.49999999999999947e89 < y Initial program 72.3%
Taylor expanded in y around inf 81.9%
mul-1-neg81.9%
Simplified81.9%
if -1.05000000000000008e153 < y < -4.6000000000000005e71 or -1.4e23 < y < 7.49999999999999947e89Initial program 98.0%
Taylor expanded in z around inf 67.4%
+-commutative67.4%
Simplified67.4%
Final simplification72.8%
(FPCore (x y z) :precision binary64 (/ 1.0 (+ (/ -1.0 (* z (/ (+ x y) y))) (/ 1.0 (+ x y)))))
double code(double x, double y, double z) {
return 1.0 / ((-1.0 / (z * ((x + y) / y))) + (1.0 / (x + y)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 / (((-1.0d0) / (z * ((x + y) / y))) + (1.0d0 / (x + y)))
end function
public static double code(double x, double y, double z) {
return 1.0 / ((-1.0 / (z * ((x + y) / y))) + (1.0 / (x + y)));
}
def code(x, y, z): return 1.0 / ((-1.0 / (z * ((x + y) / y))) + (1.0 / (x + y)))
function code(x, y, z) return Float64(1.0 / Float64(Float64(-1.0 / Float64(z * Float64(Float64(x + y) / y))) + Float64(1.0 / Float64(x + y)))) end
function tmp = code(x, y, z) tmp = 1.0 / ((-1.0 / (z * ((x + y) / y))) + (1.0 / (x + y))); end
code[x_, y_, z_] := N[(1.0 / N[(N[(-1.0 / N[(z * N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{-1}{z \cdot \frac{x + y}{y}} + \frac{1}{x + y}}
\end{array}
Initial program 88.4%
clear-num88.2%
associate-/r/88.3%
Applied egg-rr88.3%
associate-/r/88.2%
+-commutative88.2%
Applied egg-rr88.2%
Taylor expanded in z around 0 87.5%
clear-num87.5%
inv-pow87.5%
+-commutative87.5%
*-commutative87.5%
associate-/l*88.2%
Applied egg-rr88.2%
unpow-188.2%
associate-/r/97.0%
*-commutative97.0%
+-commutative97.0%
Simplified97.0%
Final simplification97.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.00055) (not (<= y 380000.0))) (- z) x))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.00055) || !(y <= 380000.0)) {
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 <= (-0.00055d0)) .or. (.not. (y <= 380000.0d0))) 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 <= -0.00055) || !(y <= 380000.0)) {
tmp = -z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.00055) or not (y <= 380000.0): tmp = -z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.00055) || !(y <= 380000.0)) tmp = Float64(-z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -0.00055) || ~((y <= 380000.0))) tmp = -z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.00055], N[Not[LessEqual[y, 380000.0]], $MachinePrecision]], (-z), x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.00055 \lor \neg \left(y \leq 380000\right):\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -5.50000000000000033e-4 or 3.8e5 < y Initial program 79.2%
Taylor expanded in y around inf 64.5%
mul-1-neg64.5%
Simplified64.5%
if -5.50000000000000033e-4 < y < 3.8e5Initial program 99.8%
Taylor expanded in y around 0 56.7%
Final simplification61.0%
(FPCore (x y z) :precision binary64 (if (<= x -1.5e-126) x (if (<= x 7.8e-176) y x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.5e-126) {
tmp = x;
} else if (x <= 7.8e-176) {
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.5d-126)) then
tmp = x
else if (x <= 7.8d-176) 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.5e-126) {
tmp = x;
} else if (x <= 7.8e-176) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.5e-126: tmp = x elif x <= 7.8e-176: tmp = y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.5e-126) tmp = x; elseif (x <= 7.8e-176) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.5e-126) tmp = x; elseif (x <= 7.8e-176) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.5e-126], x, If[LessEqual[x, 7.8e-176], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-126}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 7.8 \cdot 10^{-176}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.5000000000000001e-126 or 7.7999999999999994e-176 < x Initial program 89.2%
Taylor expanded in y around 0 38.0%
if -1.5000000000000001e-126 < x < 7.7999999999999994e-176Initial program 86.3%
Taylor expanded in x around 0 77.1%
Taylor expanded in y around 0 42.4%
Final simplification39.2%
(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 88.4%
Taylor expanded in y around 0 30.6%
Final simplification30.6%
(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 2024019
(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))))