
(FPCore (x y) :precision binary64 (/ (- x y) (- 2.0 (+ x y))))
double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (2.0d0 - (x + y))
end function
public static double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
def code(x, y): return (x - y) / (2.0 - (x + y))
function code(x, y) return Float64(Float64(x - y) / Float64(2.0 - Float64(x + y))) end
function tmp = code(x, y) tmp = (x - y) / (2.0 - (x + y)); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{2 - \left(x + y\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (- x y) (- 2.0 (+ x y))))
double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (2.0d0 - (x + y))
end function
public static double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
def code(x, y): return (x - y) / (2.0 - (x + y))
function code(x, y) return Float64(Float64(x - y) / Float64(2.0 - Float64(x + y))) end
function tmp = code(x, y) tmp = (x - y) / (2.0 - (x + y)); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{2 - \left(x + y\right)}
\end{array}
(FPCore (x y) :precision binary64 (let* ((t_0 (- 2.0 (+ x y)))) (- (/ x t_0) (/ y t_0))))
double code(double x, double y) {
double t_0 = 2.0 - (x + y);
return (x / t_0) - (y / t_0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
t_0 = 2.0d0 - (x + y)
code = (x / t_0) - (y / t_0)
end function
public static double code(double x, double y) {
double t_0 = 2.0 - (x + y);
return (x / t_0) - (y / t_0);
}
def code(x, y): t_0 = 2.0 - (x + y) return (x / t_0) - (y / t_0)
function code(x, y) t_0 = Float64(2.0 - Float64(x + y)) return Float64(Float64(x / t_0) - Float64(y / t_0)) end
function tmp = code(x, y) t_0 = 2.0 - (x + y); tmp = (x / t_0) - (y / t_0); end
code[x_, y_] := Block[{t$95$0 = N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]}, N[(N[(x / t$95$0), $MachinePrecision] - N[(y / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 - \left(x + y\right)\\
\frac{x}{t_0} - \frac{y}{t_0}
\end{array}
\end{array}
Initial program 100.0%
associate--r+100.0%
Simplified100.0%
div-sub100.0%
associate--l-100.0%
associate--l-100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ (* x -2.0) y))) (t_1 (/ x (- 2.0 x))))
(if (<= y -7200000000.0)
t_0
(if (<= y -1.3e-23)
(+ (/ y x) -1.0)
(if (<= y -2.25e-67)
(* y -0.5)
(if (<= y -1.4e-160)
t_1
(if (<= y -4e-205)
(/ y (+ y -2.0))
(if (<= y 5.5e+59) t_1 t_0))))))))
double code(double x, double y) {
double t_0 = 1.0 + ((x * -2.0) / y);
double t_1 = x / (2.0 - x);
double tmp;
if (y <= -7200000000.0) {
tmp = t_0;
} else if (y <= -1.3e-23) {
tmp = (y / x) + -1.0;
} else if (y <= -2.25e-67) {
tmp = y * -0.5;
} else if (y <= -1.4e-160) {
tmp = t_1;
} else if (y <= -4e-205) {
tmp = y / (y + -2.0);
} else if (y <= 5.5e+59) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + ((x * (-2.0d0)) / y)
t_1 = x / (2.0d0 - x)
if (y <= (-7200000000.0d0)) then
tmp = t_0
else if (y <= (-1.3d-23)) then
tmp = (y / x) + (-1.0d0)
else if (y <= (-2.25d-67)) then
tmp = y * (-0.5d0)
else if (y <= (-1.4d-160)) then
tmp = t_1
else if (y <= (-4d-205)) then
tmp = y / (y + (-2.0d0))
else if (y <= 5.5d+59) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + ((x * -2.0) / y);
double t_1 = x / (2.0 - x);
double tmp;
if (y <= -7200000000.0) {
tmp = t_0;
} else if (y <= -1.3e-23) {
tmp = (y / x) + -1.0;
} else if (y <= -2.25e-67) {
tmp = y * -0.5;
} else if (y <= -1.4e-160) {
tmp = t_1;
} else if (y <= -4e-205) {
tmp = y / (y + -2.0);
} else if (y <= 5.5e+59) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + ((x * -2.0) / y) t_1 = x / (2.0 - x) tmp = 0 if y <= -7200000000.0: tmp = t_0 elif y <= -1.3e-23: tmp = (y / x) + -1.0 elif y <= -2.25e-67: tmp = y * -0.5 elif y <= -1.4e-160: tmp = t_1 elif y <= -4e-205: tmp = y / (y + -2.0) elif y <= 5.5e+59: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(Float64(x * -2.0) / y)) t_1 = Float64(x / Float64(2.0 - x)) tmp = 0.0 if (y <= -7200000000.0) tmp = t_0; elseif (y <= -1.3e-23) tmp = Float64(Float64(y / x) + -1.0); elseif (y <= -2.25e-67) tmp = Float64(y * -0.5); elseif (y <= -1.4e-160) tmp = t_1; elseif (y <= -4e-205) tmp = Float64(y / Float64(y + -2.0)); elseif (y <= 5.5e+59) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + ((x * -2.0) / y); t_1 = x / (2.0 - x); tmp = 0.0; if (y <= -7200000000.0) tmp = t_0; elseif (y <= -1.3e-23) tmp = (y / x) + -1.0; elseif (y <= -2.25e-67) tmp = y * -0.5; elseif (y <= -1.4e-160) tmp = t_1; elseif (y <= -4e-205) tmp = y / (y + -2.0); elseif (y <= 5.5e+59) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(N[(x * -2.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7200000000.0], t$95$0, If[LessEqual[y, -1.3e-23], N[(N[(y / x), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[y, -2.25e-67], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -1.4e-160], t$95$1, If[LessEqual[y, -4e-205], N[(y / N[(y + -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.5e+59], t$95$1, t$95$0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x \cdot -2}{y}\\
t_1 := \frac{x}{2 - x}\\
\mathbf{if}\;y \leq -7200000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -1.3 \cdot 10^{-23}:\\
\;\;\;\;\frac{y}{x} + -1\\
\mathbf{elif}\;y \leq -2.25 \cdot 10^{-67}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -1.4 \cdot 10^{-160}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-205}:\\
\;\;\;\;\frac{y}{y + -2}\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+59}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -7.2e9 or 5.4999999999999999e59 < y Initial program 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in y around inf 86.9%
associate--l+86.9%
associate-*r/86.9%
associate-*r/86.9%
div-sub86.9%
cancel-sign-sub-inv86.9%
metadata-eval86.9%
*-lft-identity86.9%
+-commutative86.9%
mul-1-neg86.9%
unsub-neg86.9%
Simplified86.9%
Taylor expanded in x around inf 86.4%
*-commutative86.4%
Simplified86.4%
if -7.2e9 < y < -1.3e-23Initial program 100.0%
associate--r+100.0%
Simplified100.0%
clear-num100.0%
associate-/r/99.5%
associate--l-99.5%
Applied egg-rr99.5%
Taylor expanded in x around inf 88.8%
Taylor expanded in x around 0 89.3%
if -1.3e-23 < y < -2.25000000000000008e-67Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around 0 86.4%
mul-1-neg86.4%
distribute-neg-frac86.4%
Simplified86.4%
Taylor expanded in y around 0 86.4%
*-commutative86.4%
Simplified86.4%
if -2.25000000000000008e-67 < y < -1.40000000000000008e-160 or -4e-205 < y < 5.4999999999999999e59Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around 0 74.6%
if -1.40000000000000008e-160 < y < -4e-205Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around 0 89.2%
mul-1-neg89.2%
distribute-neg-frac89.2%
Simplified89.2%
frac-2neg89.2%
div-inv89.2%
remove-double-neg89.2%
sub-neg89.2%
distribute-neg-in89.2%
metadata-eval89.2%
remove-double-neg89.2%
Applied egg-rr89.2%
associate-*r/89.2%
*-rgt-identity89.2%
+-commutative89.2%
Simplified89.2%
Final simplification80.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (- 2.0 x))))
(if (<= y -15500000000.0)
(+ 1.0 (/ (- (- 2.0 x) x) y))
(if (<= y -8.5e-24)
(+ (/ y x) -1.0)
(if (<= y -2.2e-73)
(* y -0.5)
(if (<= y -1.4e-160)
t_0
(if (<= y -4e-205)
(/ y (+ y -2.0))
(if (<= y 5.4e+59) t_0 (+ 1.0 (/ (* x -2.0) y))))))))))
double code(double x, double y) {
double t_0 = x / (2.0 - x);
double tmp;
if (y <= -15500000000.0) {
tmp = 1.0 + (((2.0 - x) - x) / y);
} else if (y <= -8.5e-24) {
tmp = (y / x) + -1.0;
} else if (y <= -2.2e-73) {
tmp = y * -0.5;
} else if (y <= -1.4e-160) {
tmp = t_0;
} else if (y <= -4e-205) {
tmp = y / (y + -2.0);
} else if (y <= 5.4e+59) {
tmp = t_0;
} else {
tmp = 1.0 + ((x * -2.0) / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x / (2.0d0 - x)
if (y <= (-15500000000.0d0)) then
tmp = 1.0d0 + (((2.0d0 - x) - x) / y)
else if (y <= (-8.5d-24)) then
tmp = (y / x) + (-1.0d0)
else if (y <= (-2.2d-73)) then
tmp = y * (-0.5d0)
else if (y <= (-1.4d-160)) then
tmp = t_0
else if (y <= (-4d-205)) then
tmp = y / (y + (-2.0d0))
else if (y <= 5.4d+59) then
tmp = t_0
else
tmp = 1.0d0 + ((x * (-2.0d0)) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (2.0 - x);
double tmp;
if (y <= -15500000000.0) {
tmp = 1.0 + (((2.0 - x) - x) / y);
} else if (y <= -8.5e-24) {
tmp = (y / x) + -1.0;
} else if (y <= -2.2e-73) {
tmp = y * -0.5;
} else if (y <= -1.4e-160) {
tmp = t_0;
} else if (y <= -4e-205) {
tmp = y / (y + -2.0);
} else if (y <= 5.4e+59) {
tmp = t_0;
} else {
tmp = 1.0 + ((x * -2.0) / y);
}
return tmp;
}
def code(x, y): t_0 = x / (2.0 - x) tmp = 0 if y <= -15500000000.0: tmp = 1.0 + (((2.0 - x) - x) / y) elif y <= -8.5e-24: tmp = (y / x) + -1.0 elif y <= -2.2e-73: tmp = y * -0.5 elif y <= -1.4e-160: tmp = t_0 elif y <= -4e-205: tmp = y / (y + -2.0) elif y <= 5.4e+59: tmp = t_0 else: tmp = 1.0 + ((x * -2.0) / y) return tmp
function code(x, y) t_0 = Float64(x / Float64(2.0 - x)) tmp = 0.0 if (y <= -15500000000.0) tmp = Float64(1.0 + Float64(Float64(Float64(2.0 - x) - x) / y)); elseif (y <= -8.5e-24) tmp = Float64(Float64(y / x) + -1.0); elseif (y <= -2.2e-73) tmp = Float64(y * -0.5); elseif (y <= -1.4e-160) tmp = t_0; elseif (y <= -4e-205) tmp = Float64(y / Float64(y + -2.0)); elseif (y <= 5.4e+59) tmp = t_0; else tmp = Float64(1.0 + Float64(Float64(x * -2.0) / y)); end return tmp end
function tmp_2 = code(x, y) t_0 = x / (2.0 - x); tmp = 0.0; if (y <= -15500000000.0) tmp = 1.0 + (((2.0 - x) - x) / y); elseif (y <= -8.5e-24) tmp = (y / x) + -1.0; elseif (y <= -2.2e-73) tmp = y * -0.5; elseif (y <= -1.4e-160) tmp = t_0; elseif (y <= -4e-205) tmp = y / (y + -2.0); elseif (y <= 5.4e+59) tmp = t_0; else tmp = 1.0 + ((x * -2.0) / y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -15500000000.0], N[(1.0 + N[(N[(N[(2.0 - x), $MachinePrecision] - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -8.5e-24], N[(N[(y / x), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[y, -2.2e-73], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -1.4e-160], t$95$0, If[LessEqual[y, -4e-205], N[(y / N[(y + -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.4e+59], t$95$0, N[(1.0 + N[(N[(x * -2.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{2 - x}\\
\mathbf{if}\;y \leq -15500000000:\\
\;\;\;\;1 + \frac{\left(2 - x\right) - x}{y}\\
\mathbf{elif}\;y \leq -8.5 \cdot 10^{-24}:\\
\;\;\;\;\frac{y}{x} + -1\\
\mathbf{elif}\;y \leq -2.2 \cdot 10^{-73}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -1.4 \cdot 10^{-160}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-205}:\\
\;\;\;\;\frac{y}{y + -2}\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{+59}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{x \cdot -2}{y}\\
\end{array}
\end{array}
if y < -1.55e10Initial program 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in y around inf 81.9%
associate--l+81.9%
associate-*r/81.9%
associate-*r/81.9%
div-sub81.9%
cancel-sign-sub-inv81.9%
metadata-eval81.9%
*-lft-identity81.9%
+-commutative81.9%
mul-1-neg81.9%
unsub-neg81.9%
Simplified81.9%
if -1.55e10 < y < -8.5000000000000002e-24Initial program 100.0%
associate--r+100.0%
Simplified100.0%
clear-num100.0%
associate-/r/99.5%
associate--l-99.5%
Applied egg-rr99.5%
Taylor expanded in x around inf 88.8%
Taylor expanded in x around 0 89.3%
if -8.5000000000000002e-24 < y < -2.2e-73Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around 0 86.4%
mul-1-neg86.4%
distribute-neg-frac86.4%
Simplified86.4%
Taylor expanded in y around 0 86.4%
*-commutative86.4%
Simplified86.4%
if -2.2e-73 < y < -1.40000000000000008e-160 or -4e-205 < y < 5.4000000000000002e59Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around 0 74.6%
if -1.40000000000000008e-160 < y < -4e-205Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around 0 89.2%
mul-1-neg89.2%
distribute-neg-frac89.2%
Simplified89.2%
frac-2neg89.2%
div-inv89.2%
remove-double-neg89.2%
sub-neg89.2%
distribute-neg-in89.2%
metadata-eval89.2%
remove-double-neg89.2%
Applied egg-rr89.2%
associate-*r/89.2%
*-rgt-identity89.2%
+-commutative89.2%
Simplified89.2%
if 5.4000000000000002e59 < y Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around inf 94.4%
associate--l+94.4%
associate-*r/94.4%
associate-*r/94.4%
div-sub94.4%
cancel-sign-sub-inv94.4%
metadata-eval94.4%
*-lft-identity94.4%
+-commutative94.4%
mul-1-neg94.4%
unsub-neg94.4%
Simplified94.4%
Taylor expanded in x around inf 94.4%
*-commutative94.4%
Simplified94.4%
Final simplification80.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (- 2.0 x))))
(if (<= y -136000000000.0)
1.0
(if (<= y -1e-23)
(+ (/ y x) -1.0)
(if (<= y -1.4e-67)
(* y -0.5)
(if (<= y -1.4e-160)
t_0
(if (<= y -4e-205) (* y -0.5) (if (<= y 8e+59) t_0 1.0))))))))
double code(double x, double y) {
double t_0 = x / (2.0 - x);
double tmp;
if (y <= -136000000000.0) {
tmp = 1.0;
} else if (y <= -1e-23) {
tmp = (y / x) + -1.0;
} else if (y <= -1.4e-67) {
tmp = y * -0.5;
} else if (y <= -1.4e-160) {
tmp = t_0;
} else if (y <= -4e-205) {
tmp = y * -0.5;
} else if (y <= 8e+59) {
tmp = t_0;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x / (2.0d0 - x)
if (y <= (-136000000000.0d0)) then
tmp = 1.0d0
else if (y <= (-1d-23)) then
tmp = (y / x) + (-1.0d0)
else if (y <= (-1.4d-67)) then
tmp = y * (-0.5d0)
else if (y <= (-1.4d-160)) then
tmp = t_0
else if (y <= (-4d-205)) then
tmp = y * (-0.5d0)
else if (y <= 8d+59) then
tmp = t_0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (2.0 - x);
double tmp;
if (y <= -136000000000.0) {
tmp = 1.0;
} else if (y <= -1e-23) {
tmp = (y / x) + -1.0;
} else if (y <= -1.4e-67) {
tmp = y * -0.5;
} else if (y <= -1.4e-160) {
tmp = t_0;
} else if (y <= -4e-205) {
tmp = y * -0.5;
} else if (y <= 8e+59) {
tmp = t_0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = x / (2.0 - x) tmp = 0 if y <= -136000000000.0: tmp = 1.0 elif y <= -1e-23: tmp = (y / x) + -1.0 elif y <= -1.4e-67: tmp = y * -0.5 elif y <= -1.4e-160: tmp = t_0 elif y <= -4e-205: tmp = y * -0.5 elif y <= 8e+59: tmp = t_0 else: tmp = 1.0 return tmp
function code(x, y) t_0 = Float64(x / Float64(2.0 - x)) tmp = 0.0 if (y <= -136000000000.0) tmp = 1.0; elseif (y <= -1e-23) tmp = Float64(Float64(y / x) + -1.0); elseif (y <= -1.4e-67) tmp = Float64(y * -0.5); elseif (y <= -1.4e-160) tmp = t_0; elseif (y <= -4e-205) tmp = Float64(y * -0.5); elseif (y <= 8e+59) tmp = t_0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (2.0 - x); tmp = 0.0; if (y <= -136000000000.0) tmp = 1.0; elseif (y <= -1e-23) tmp = (y / x) + -1.0; elseif (y <= -1.4e-67) tmp = y * -0.5; elseif (y <= -1.4e-160) tmp = t_0; elseif (y <= -4e-205) tmp = y * -0.5; elseif (y <= 8e+59) tmp = t_0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -136000000000.0], 1.0, If[LessEqual[y, -1e-23], N[(N[(y / x), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[y, -1.4e-67], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -1.4e-160], t$95$0, If[LessEqual[y, -4e-205], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 8e+59], t$95$0, 1.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{2 - x}\\
\mathbf{if}\;y \leq -136000000000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -1 \cdot 10^{-23}:\\
\;\;\;\;\frac{y}{x} + -1\\
\mathbf{elif}\;y \leq -1.4 \cdot 10^{-67}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -1.4 \cdot 10^{-160}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-205}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+59}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.36e11 or 7.99999999999999977e59 < y Initial program 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in y around inf 85.5%
if -1.36e11 < y < -9.9999999999999996e-24Initial program 100.0%
associate--r+100.0%
Simplified100.0%
clear-num100.0%
associate-/r/99.5%
associate--l-99.5%
Applied egg-rr99.5%
Taylor expanded in x around inf 88.8%
Taylor expanded in x around 0 89.3%
if -9.9999999999999996e-24 < y < -1.40000000000000005e-67 or -1.40000000000000008e-160 < y < -4e-205Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around 0 87.7%
mul-1-neg87.7%
distribute-neg-frac87.7%
Simplified87.7%
Taylor expanded in y around 0 87.7%
*-commutative87.7%
Simplified87.7%
if -1.40000000000000005e-67 < y < -1.40000000000000008e-160 or -4e-205 < y < 7.99999999999999977e59Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around 0 74.6%
Final simplification80.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ y -2.0))) (t_1 (/ x (- 2.0 x))))
(if (<= y -1860000000.0)
t_0
(if (<= y -1.06e-24)
(+ (/ y x) -1.0)
(if (<= y -5.9e-68)
(* y -0.5)
(if (<= y -1.4e-160)
t_1
(if (<= y -4e-205) t_0 (if (<= y 1.25e+63) t_1 1.0))))))))
double code(double x, double y) {
double t_0 = y / (y + -2.0);
double t_1 = x / (2.0 - x);
double tmp;
if (y <= -1860000000.0) {
tmp = t_0;
} else if (y <= -1.06e-24) {
tmp = (y / x) + -1.0;
} else if (y <= -5.9e-68) {
tmp = y * -0.5;
} else if (y <= -1.4e-160) {
tmp = t_1;
} else if (y <= -4e-205) {
tmp = t_0;
} else if (y <= 1.25e+63) {
tmp = t_1;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = y / (y + (-2.0d0))
t_1 = x / (2.0d0 - x)
if (y <= (-1860000000.0d0)) then
tmp = t_0
else if (y <= (-1.06d-24)) then
tmp = (y / x) + (-1.0d0)
else if (y <= (-5.9d-68)) then
tmp = y * (-0.5d0)
else if (y <= (-1.4d-160)) then
tmp = t_1
else if (y <= (-4d-205)) then
tmp = t_0
else if (y <= 1.25d+63) then
tmp = t_1
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y / (y + -2.0);
double t_1 = x / (2.0 - x);
double tmp;
if (y <= -1860000000.0) {
tmp = t_0;
} else if (y <= -1.06e-24) {
tmp = (y / x) + -1.0;
} else if (y <= -5.9e-68) {
tmp = y * -0.5;
} else if (y <= -1.4e-160) {
tmp = t_1;
} else if (y <= -4e-205) {
tmp = t_0;
} else if (y <= 1.25e+63) {
tmp = t_1;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = y / (y + -2.0) t_1 = x / (2.0 - x) tmp = 0 if y <= -1860000000.0: tmp = t_0 elif y <= -1.06e-24: tmp = (y / x) + -1.0 elif y <= -5.9e-68: tmp = y * -0.5 elif y <= -1.4e-160: tmp = t_1 elif y <= -4e-205: tmp = t_0 elif y <= 1.25e+63: tmp = t_1 else: tmp = 1.0 return tmp
function code(x, y) t_0 = Float64(y / Float64(y + -2.0)) t_1 = Float64(x / Float64(2.0 - x)) tmp = 0.0 if (y <= -1860000000.0) tmp = t_0; elseif (y <= -1.06e-24) tmp = Float64(Float64(y / x) + -1.0); elseif (y <= -5.9e-68) tmp = Float64(y * -0.5); elseif (y <= -1.4e-160) tmp = t_1; elseif (y <= -4e-205) tmp = t_0; elseif (y <= 1.25e+63) tmp = t_1; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) t_0 = y / (y + -2.0); t_1 = x / (2.0 - x); tmp = 0.0; if (y <= -1860000000.0) tmp = t_0; elseif (y <= -1.06e-24) tmp = (y / x) + -1.0; elseif (y <= -5.9e-68) tmp = y * -0.5; elseif (y <= -1.4e-160) tmp = t_1; elseif (y <= -4e-205) tmp = t_0; elseif (y <= 1.25e+63) tmp = t_1; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y / N[(y + -2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1860000000.0], t$95$0, If[LessEqual[y, -1.06e-24], N[(N[(y / x), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[y, -5.9e-68], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -1.4e-160], t$95$1, If[LessEqual[y, -4e-205], t$95$0, If[LessEqual[y, 1.25e+63], t$95$1, 1.0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{y + -2}\\
t_1 := \frac{x}{2 - x}\\
\mathbf{if}\;y \leq -1860000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -1.06 \cdot 10^{-24}:\\
\;\;\;\;\frac{y}{x} + -1\\
\mathbf{elif}\;y \leq -5.9 \cdot 10^{-68}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -1.4 \cdot 10^{-160}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-205}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+63}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -1.86e9 or -1.40000000000000008e-160 < y < -4e-205Initial program 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in x around 0 82.0%
mul-1-neg82.0%
distribute-neg-frac82.0%
Simplified82.0%
frac-2neg82.0%
div-inv81.8%
remove-double-neg81.8%
sub-neg81.8%
distribute-neg-in81.8%
metadata-eval81.8%
remove-double-neg81.8%
Applied egg-rr81.8%
associate-*r/82.0%
*-rgt-identity82.0%
+-commutative82.0%
Simplified82.0%
if -1.86e9 < y < -1.0599999999999999e-24Initial program 100.0%
associate--r+100.0%
Simplified100.0%
clear-num100.0%
associate-/r/99.5%
associate--l-99.5%
Applied egg-rr99.5%
Taylor expanded in x around inf 88.8%
Taylor expanded in x around 0 89.3%
if -1.0599999999999999e-24 < y < -5.9e-68Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around 0 86.4%
mul-1-neg86.4%
distribute-neg-frac86.4%
Simplified86.4%
Taylor expanded in y around 0 86.4%
*-commutative86.4%
Simplified86.4%
if -5.9e-68 < y < -1.40000000000000008e-160 or -4e-205 < y < 1.25000000000000003e63Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around 0 74.6%
if 1.25000000000000003e63 < y Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around inf 93.7%
Final simplification80.6%
(FPCore (x y)
:precision binary64
(if (<= y -95000000000.0)
1.0
(if (<= y -8e-24)
-1.0
(if (<= y -3.9e-205)
(* y -0.5)
(if (<= y -4.8e-303) (* x 0.5) (if (<= y 5.4e+59) -1.0 1.0))))))
double code(double x, double y) {
double tmp;
if (y <= -95000000000.0) {
tmp = 1.0;
} else if (y <= -8e-24) {
tmp = -1.0;
} else if (y <= -3.9e-205) {
tmp = y * -0.5;
} else if (y <= -4.8e-303) {
tmp = x * 0.5;
} else if (y <= 5.4e+59) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-95000000000.0d0)) then
tmp = 1.0d0
else if (y <= (-8d-24)) then
tmp = -1.0d0
else if (y <= (-3.9d-205)) then
tmp = y * (-0.5d0)
else if (y <= (-4.8d-303)) then
tmp = x * 0.5d0
else if (y <= 5.4d+59) then
tmp = -1.0d0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -95000000000.0) {
tmp = 1.0;
} else if (y <= -8e-24) {
tmp = -1.0;
} else if (y <= -3.9e-205) {
tmp = y * -0.5;
} else if (y <= -4.8e-303) {
tmp = x * 0.5;
} else if (y <= 5.4e+59) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -95000000000.0: tmp = 1.0 elif y <= -8e-24: tmp = -1.0 elif y <= -3.9e-205: tmp = y * -0.5 elif y <= -4.8e-303: tmp = x * 0.5 elif y <= 5.4e+59: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -95000000000.0) tmp = 1.0; elseif (y <= -8e-24) tmp = -1.0; elseif (y <= -3.9e-205) tmp = Float64(y * -0.5); elseif (y <= -4.8e-303) tmp = Float64(x * 0.5); elseif (y <= 5.4e+59) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -95000000000.0) tmp = 1.0; elseif (y <= -8e-24) tmp = -1.0; elseif (y <= -3.9e-205) tmp = y * -0.5; elseif (y <= -4.8e-303) tmp = x * 0.5; elseif (y <= 5.4e+59) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -95000000000.0], 1.0, If[LessEqual[y, -8e-24], -1.0, If[LessEqual[y, -3.9e-205], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -4.8e-303], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 5.4e+59], -1.0, 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -95000000000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -8 \cdot 10^{-24}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq -3.9 \cdot 10^{-205}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -4.8 \cdot 10^{-303}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{+59}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -9.5e10 or 5.4000000000000002e59 < y Initial program 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in y around inf 85.5%
if -9.5e10 < y < -7.99999999999999939e-24 or -4.8000000000000002e-303 < y < 5.4000000000000002e59Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around inf 56.9%
if -7.99999999999999939e-24 < y < -3.90000000000000018e-205Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around 0 61.1%
mul-1-neg61.1%
distribute-neg-frac61.1%
Simplified61.1%
Taylor expanded in y around 0 61.1%
*-commutative61.1%
Simplified61.1%
if -3.90000000000000018e-205 < y < -4.8000000000000002e-303Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around 0 85.2%
Taylor expanded in x around 0 64.4%
*-commutative64.4%
Simplified64.4%
Final simplification69.3%
(FPCore (x y)
:precision binary64
(if (<= y -240000000000.0)
1.0
(if (<= y -2.7e-24)
(+ (/ y x) -1.0)
(if (<= y -3.3e-205)
(* y -0.5)
(if (<= y -4.6e-302) (* x 0.5) (if (<= y 5.5e+59) -1.0 1.0))))))
double code(double x, double y) {
double tmp;
if (y <= -240000000000.0) {
tmp = 1.0;
} else if (y <= -2.7e-24) {
tmp = (y / x) + -1.0;
} else if (y <= -3.3e-205) {
tmp = y * -0.5;
} else if (y <= -4.6e-302) {
tmp = x * 0.5;
} else if (y <= 5.5e+59) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-240000000000.0d0)) then
tmp = 1.0d0
else if (y <= (-2.7d-24)) then
tmp = (y / x) + (-1.0d0)
else if (y <= (-3.3d-205)) then
tmp = y * (-0.5d0)
else if (y <= (-4.6d-302)) then
tmp = x * 0.5d0
else if (y <= 5.5d+59) then
tmp = -1.0d0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -240000000000.0) {
tmp = 1.0;
} else if (y <= -2.7e-24) {
tmp = (y / x) + -1.0;
} else if (y <= -3.3e-205) {
tmp = y * -0.5;
} else if (y <= -4.6e-302) {
tmp = x * 0.5;
} else if (y <= 5.5e+59) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -240000000000.0: tmp = 1.0 elif y <= -2.7e-24: tmp = (y / x) + -1.0 elif y <= -3.3e-205: tmp = y * -0.5 elif y <= -4.6e-302: tmp = x * 0.5 elif y <= 5.5e+59: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -240000000000.0) tmp = 1.0; elseif (y <= -2.7e-24) tmp = Float64(Float64(y / x) + -1.0); elseif (y <= -3.3e-205) tmp = Float64(y * -0.5); elseif (y <= -4.6e-302) tmp = Float64(x * 0.5); elseif (y <= 5.5e+59) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -240000000000.0) tmp = 1.0; elseif (y <= -2.7e-24) tmp = (y / x) + -1.0; elseif (y <= -3.3e-205) tmp = y * -0.5; elseif (y <= -4.6e-302) tmp = x * 0.5; elseif (y <= 5.5e+59) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -240000000000.0], 1.0, If[LessEqual[y, -2.7e-24], N[(N[(y / x), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[y, -3.3e-205], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, -4.6e-302], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 5.5e+59], -1.0, 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -240000000000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -2.7 \cdot 10^{-24}:\\
\;\;\;\;\frac{y}{x} + -1\\
\mathbf{elif}\;y \leq -3.3 \cdot 10^{-205}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq -4.6 \cdot 10^{-302}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+59}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.4e11 or 5.4999999999999999e59 < y Initial program 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in y around inf 85.5%
if -2.4e11 < y < -2.70000000000000007e-24Initial program 100.0%
associate--r+100.0%
Simplified100.0%
clear-num100.0%
associate-/r/99.5%
associate--l-99.5%
Applied egg-rr99.5%
Taylor expanded in x around inf 88.8%
Taylor expanded in x around 0 89.3%
if -2.70000000000000007e-24 < y < -3.2999999999999999e-205Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around 0 61.1%
mul-1-neg61.1%
distribute-neg-frac61.1%
Simplified61.1%
Taylor expanded in y around 0 61.1%
*-commutative61.1%
Simplified61.1%
if -3.2999999999999999e-205 < y < -4.60000000000000004e-302Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around 0 85.2%
Taylor expanded in x around 0 64.4%
*-commutative64.4%
Simplified64.4%
if -4.60000000000000004e-302 < y < 5.4999999999999999e59Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around inf 53.7%
Final simplification69.3%
(FPCore (x y)
:precision binary64
(if (<= y -230000000000.0)
1.0
(if (<= y -1.75e-155)
-1.0
(if (<= y -7.2e-304) (* x 0.5) (if (<= y 5.4e+59) -1.0 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -230000000000.0) {
tmp = 1.0;
} else if (y <= -1.75e-155) {
tmp = -1.0;
} else if (y <= -7.2e-304) {
tmp = x * 0.5;
} else if (y <= 5.4e+59) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-230000000000.0d0)) then
tmp = 1.0d0
else if (y <= (-1.75d-155)) then
tmp = -1.0d0
else if (y <= (-7.2d-304)) then
tmp = x * 0.5d0
else if (y <= 5.4d+59) then
tmp = -1.0d0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -230000000000.0) {
tmp = 1.0;
} else if (y <= -1.75e-155) {
tmp = -1.0;
} else if (y <= -7.2e-304) {
tmp = x * 0.5;
} else if (y <= 5.4e+59) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -230000000000.0: tmp = 1.0 elif y <= -1.75e-155: tmp = -1.0 elif y <= -7.2e-304: tmp = x * 0.5 elif y <= 5.4e+59: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -230000000000.0) tmp = 1.0; elseif (y <= -1.75e-155) tmp = -1.0; elseif (y <= -7.2e-304) tmp = Float64(x * 0.5); elseif (y <= 5.4e+59) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -230000000000.0) tmp = 1.0; elseif (y <= -1.75e-155) tmp = -1.0; elseif (y <= -7.2e-304) tmp = x * 0.5; elseif (y <= 5.4e+59) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -230000000000.0], 1.0, If[LessEqual[y, -1.75e-155], -1.0, If[LessEqual[y, -7.2e-304], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 5.4e+59], -1.0, 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -230000000000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -1.75 \cdot 10^{-155}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq -7.2 \cdot 10^{-304}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{+59}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.3e11 or 5.4000000000000002e59 < y Initial program 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in y around inf 85.5%
if -2.3e11 < y < -1.75000000000000008e-155 or -7.2000000000000003e-304 < y < 5.4000000000000002e59Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around inf 52.0%
if -1.75000000000000008e-155 < y < -7.2000000000000003e-304Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around 0 64.0%
Taylor expanded in x around 0 50.5%
*-commutative50.5%
Simplified50.5%
Final simplification65.0%
(FPCore (x y) :precision binary64 (/ (- x y) (- 2.0 (+ x y))))
double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / (2.0d0 - (x + y))
end function
public static double code(double x, double y) {
return (x - y) / (2.0 - (x + y));
}
def code(x, y): return (x - y) / (2.0 - (x + y))
function code(x, y) return Float64(Float64(x - y) / Float64(2.0 - Float64(x + y))) end
function tmp = code(x, y) tmp = (x - y) / (2.0 - (x + y)); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{2 - \left(x + y\right)}
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (if (<= y -8800000000.0) 1.0 (if (<= y 6e+59) -1.0 1.0)))
double code(double x, double y) {
double tmp;
if (y <= -8800000000.0) {
tmp = 1.0;
} else if (y <= 6e+59) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-8800000000.0d0)) then
tmp = 1.0d0
else if (y <= 6d+59) then
tmp = -1.0d0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -8800000000.0) {
tmp = 1.0;
} else if (y <= 6e+59) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -8800000000.0: tmp = 1.0 elif y <= 6e+59: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -8800000000.0) tmp = 1.0; elseif (y <= 6e+59) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -8800000000.0) tmp = 1.0; elseif (y <= 6e+59) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -8800000000.0], 1.0, If[LessEqual[y, 6e+59], -1.0, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8800000000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+59}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -8.8e9 or 6.0000000000000001e59 < y Initial program 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in y around inf 85.5%
if -8.8e9 < y < 6.0000000000000001e59Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around inf 45.5%
Final simplification61.3%
(FPCore (x y) :precision binary64 -1.0)
double code(double x, double y) {
return -1.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = -1.0d0
end function
public static double code(double x, double y) {
return -1.0;
}
def code(x, y): return -1.0
function code(x, y) return -1.0 end
function tmp = code(x, y) tmp = -1.0; end
code[x_, y_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around inf 32.1%
Final simplification32.1%
(FPCore (x y) :precision binary64 (let* ((t_0 (- 2.0 (+ x y)))) (- (/ x t_0) (/ y t_0))))
double code(double x, double y) {
double t_0 = 2.0 - (x + y);
return (x / t_0) - (y / t_0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
t_0 = 2.0d0 - (x + y)
code = (x / t_0) - (y / t_0)
end function
public static double code(double x, double y) {
double t_0 = 2.0 - (x + y);
return (x / t_0) - (y / t_0);
}
def code(x, y): t_0 = 2.0 - (x + y) return (x / t_0) - (y / t_0)
function code(x, y) t_0 = Float64(2.0 - Float64(x + y)) return Float64(Float64(x / t_0) - Float64(y / t_0)) end
function tmp = code(x, y) t_0 = 2.0 - (x + y); tmp = (x / t_0) - (y / t_0); end
code[x_, y_] := Block[{t$95$0 = N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]}, N[(N[(x / t$95$0), $MachinePrecision] - N[(y / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 - \left(x + y\right)\\
\frac{x}{t_0} - \frac{y}{t_0}
\end{array}
\end{array}
herbie shell --seed 2023218
(FPCore (x y)
:name "Data.Colour.RGB:hslsv from colour-2.3.3, C"
:precision binary64
:herbie-target
(- (/ x (- 2.0 (+ x y))) (/ y (- 2.0 (+ x y))))
(/ (- x y) (- 2.0 (+ x y))))