
(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 12 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 (/ (- x y) (+ (* x -2.0) (+ (- x y) 2.0))))
double code(double x, double y) {
return (x - y) / ((x * -2.0) + ((x - y) + 2.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x - y) / ((x * (-2.0d0)) + ((x - y) + 2.0d0))
end function
public static double code(double x, double y) {
return (x - y) / ((x * -2.0) + ((x - y) + 2.0));
}
def code(x, y): return (x - y) / ((x * -2.0) + ((x - y) + 2.0))
function code(x, y) return Float64(Float64(x - y) / Float64(Float64(x * -2.0) + Float64(Float64(x - y) + 2.0))) end
function tmp = code(x, y) tmp = (x - y) / ((x * -2.0) + ((x - y) + 2.0)); end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(N[(x * -2.0), $MachinePrecision] + N[(N[(x - y), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{x \cdot -2 + \left(\left(x - y\right) + 2\right)}
\end{array}
Initial program 100.0%
sub-neg100.0%
flip-+56.4%
metadata-eval56.4%
Applied egg-rr56.4%
Taylor expanded in y around inf 100.0%
neg-mul-1100.0%
associate--l+100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
*-lft-identity100.0%
+-commutative100.0%
sub-neg100.0%
associate--l+100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))))
(if (<= y -3.8e+72)
t_0
(if (<= y -3e+56)
-1.0
(if (<= y -8000000000.0)
(+ 1.0 (/ 2.0 y))
(if (<= y 7.8e-80)
-1.0
(if (<= y 1.5e-31) (* y -0.5) (if (<= y 1.35e+40) -1.0 t_0))))))))
double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -3.8e+72) {
tmp = t_0;
} else if (y <= -3e+56) {
tmp = -1.0;
} else if (y <= -8000000000.0) {
tmp = 1.0 + (2.0 / y);
} else if (y <= 7.8e-80) {
tmp = -1.0;
} else if (y <= 1.5e-31) {
tmp = y * -0.5;
} else if (y <= 1.35e+40) {
tmp = -1.0;
} 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) :: tmp
t_0 = 1.0d0 - (x / y)
if (y <= (-3.8d+72)) then
tmp = t_0
else if (y <= (-3d+56)) then
tmp = -1.0d0
else if (y <= (-8000000000.0d0)) then
tmp = 1.0d0 + (2.0d0 / y)
else if (y <= 7.8d-80) then
tmp = -1.0d0
else if (y <= 1.5d-31) then
tmp = y * (-0.5d0)
else if (y <= 1.35d+40) then
tmp = -1.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -3.8e+72) {
tmp = t_0;
} else if (y <= -3e+56) {
tmp = -1.0;
} else if (y <= -8000000000.0) {
tmp = 1.0 + (2.0 / y);
} else if (y <= 7.8e-80) {
tmp = -1.0;
} else if (y <= 1.5e-31) {
tmp = y * -0.5;
} else if (y <= 1.35e+40) {
tmp = -1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 - (x / y) tmp = 0 if y <= -3.8e+72: tmp = t_0 elif y <= -3e+56: tmp = -1.0 elif y <= -8000000000.0: tmp = 1.0 + (2.0 / y) elif y <= 7.8e-80: tmp = -1.0 elif y <= 1.5e-31: tmp = y * -0.5 elif y <= 1.35e+40: tmp = -1.0 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 - Float64(x / y)) tmp = 0.0 if (y <= -3.8e+72) tmp = t_0; elseif (y <= -3e+56) tmp = -1.0; elseif (y <= -8000000000.0) tmp = Float64(1.0 + Float64(2.0 / y)); elseif (y <= 7.8e-80) tmp = -1.0; elseif (y <= 1.5e-31) tmp = Float64(y * -0.5); elseif (y <= 1.35e+40) tmp = -1.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 - (x / y); tmp = 0.0; if (y <= -3.8e+72) tmp = t_0; elseif (y <= -3e+56) tmp = -1.0; elseif (y <= -8000000000.0) tmp = 1.0 + (2.0 / y); elseif (y <= 7.8e-80) tmp = -1.0; elseif (y <= 1.5e-31) tmp = y * -0.5; elseif (y <= 1.35e+40) tmp = -1.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.8e+72], t$95$0, If[LessEqual[y, -3e+56], -1.0, If[LessEqual[y, -8000000000.0], N[(1.0 + N[(2.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.8e-80], -1.0, If[LessEqual[y, 1.5e-31], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.35e+40], -1.0, t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -3.8 \cdot 10^{+72}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -3 \cdot 10^{+56}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq -8000000000:\\
\;\;\;\;1 + \frac{2}{y}\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{-80}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{-31}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+40}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -3.80000000000000006e72 or 1.35000000000000005e40 < y Initial program 99.9%
Taylor expanded in y around inf 81.2%
neg-mul-181.2%
Simplified81.2%
Taylor expanded in x around 0 81.2%
mul-1-neg81.2%
unsub-neg81.2%
Simplified81.2%
if -3.80000000000000006e72 < y < -3.00000000000000006e56 or -8e9 < y < 7.7999999999999995e-80 or 1.49999999999999991e-31 < y < 1.35000000000000005e40Initial program 100.0%
Taylor expanded in x around inf 56.4%
if -3.00000000000000006e56 < y < -8e9Initial program 100.0%
sub-neg100.0%
flip-+78.5%
metadata-eval78.5%
Applied egg-rr78.5%
Taylor expanded in y around -inf 78.0%
associate-*r/78.0%
cancel-sign-sub-inv78.0%
metadata-eval78.0%
distribute-lft-in78.0%
distribute-rgt1-in78.0%
metadata-eval78.0%
mul0-lft78.0%
metadata-eval78.0%
metadata-eval78.0%
metadata-eval78.0%
neg-mul-178.0%
distribute-lft-neg-in78.0%
metadata-eval78.0%
*-commutative78.0%
Simplified78.0%
Taylor expanded in x around 0 78.1%
associate-*r/78.1%
metadata-eval78.1%
Simplified78.1%
if 7.7999999999999995e-80 < y < 1.49999999999999991e-31Initial program 100.0%
Taylor expanded in x around 0 68.7%
associate-*r/68.7%
neg-mul-168.7%
Simplified68.7%
Taylor expanded in y around 0 68.7%
*-commutative68.7%
Simplified68.7%
Final simplification67.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))))
(if (<= y -2.6e+72)
t_0
(if (<= y -1.3e+55)
-1.0
(if (<= y -22000000000.0)
(+ 1.0 (/ 2.0 y))
(if (<= y 8.5e-93)
(+ (/ y x) -1.0)
(if (<= y 2.45e-29) (* y -0.5) (if (<= y 1.34e+39) -1.0 t_0))))))))
double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -2.6e+72) {
tmp = t_0;
} else if (y <= -1.3e+55) {
tmp = -1.0;
} else if (y <= -22000000000.0) {
tmp = 1.0 + (2.0 / y);
} else if (y <= 8.5e-93) {
tmp = (y / x) + -1.0;
} else if (y <= 2.45e-29) {
tmp = y * -0.5;
} else if (y <= 1.34e+39) {
tmp = -1.0;
} 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) :: tmp
t_0 = 1.0d0 - (x / y)
if (y <= (-2.6d+72)) then
tmp = t_0
else if (y <= (-1.3d+55)) then
tmp = -1.0d0
else if (y <= (-22000000000.0d0)) then
tmp = 1.0d0 + (2.0d0 / y)
else if (y <= 8.5d-93) then
tmp = (y / x) + (-1.0d0)
else if (y <= 2.45d-29) then
tmp = y * (-0.5d0)
else if (y <= 1.34d+39) then
tmp = -1.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -2.6e+72) {
tmp = t_0;
} else if (y <= -1.3e+55) {
tmp = -1.0;
} else if (y <= -22000000000.0) {
tmp = 1.0 + (2.0 / y);
} else if (y <= 8.5e-93) {
tmp = (y / x) + -1.0;
} else if (y <= 2.45e-29) {
tmp = y * -0.5;
} else if (y <= 1.34e+39) {
tmp = -1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 - (x / y) tmp = 0 if y <= -2.6e+72: tmp = t_0 elif y <= -1.3e+55: tmp = -1.0 elif y <= -22000000000.0: tmp = 1.0 + (2.0 / y) elif y <= 8.5e-93: tmp = (y / x) + -1.0 elif y <= 2.45e-29: tmp = y * -0.5 elif y <= 1.34e+39: tmp = -1.0 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 - Float64(x / y)) tmp = 0.0 if (y <= -2.6e+72) tmp = t_0; elseif (y <= -1.3e+55) tmp = -1.0; elseif (y <= -22000000000.0) tmp = Float64(1.0 + Float64(2.0 / y)); elseif (y <= 8.5e-93) tmp = Float64(Float64(y / x) + -1.0); elseif (y <= 2.45e-29) tmp = Float64(y * -0.5); elseif (y <= 1.34e+39) tmp = -1.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 - (x / y); tmp = 0.0; if (y <= -2.6e+72) tmp = t_0; elseif (y <= -1.3e+55) tmp = -1.0; elseif (y <= -22000000000.0) tmp = 1.0 + (2.0 / y); elseif (y <= 8.5e-93) tmp = (y / x) + -1.0; elseif (y <= 2.45e-29) tmp = y * -0.5; elseif (y <= 1.34e+39) tmp = -1.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.6e+72], t$95$0, If[LessEqual[y, -1.3e+55], -1.0, If[LessEqual[y, -22000000000.0], N[(1.0 + N[(2.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.5e-93], N[(N[(y / x), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[y, 2.45e-29], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.34e+39], -1.0, t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -2.6 \cdot 10^{+72}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -1.3 \cdot 10^{+55}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq -22000000000:\\
\;\;\;\;1 + \frac{2}{y}\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{-93}:\\
\;\;\;\;\frac{y}{x} + -1\\
\mathbf{elif}\;y \leq 2.45 \cdot 10^{-29}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.34 \cdot 10^{+39}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -2.59999999999999981e72 or 1.34000000000000005e39 < y Initial program 99.9%
Taylor expanded in y around inf 81.2%
neg-mul-181.2%
Simplified81.2%
Taylor expanded in x around 0 81.2%
mul-1-neg81.2%
unsub-neg81.2%
Simplified81.2%
if -2.59999999999999981e72 < y < -1.3e55 or 2.4499999999999999e-29 < y < 1.34000000000000005e39Initial program 100.0%
Taylor expanded in x around inf 84.1%
if -1.3e55 < y < -2.2e10Initial program 100.0%
sub-neg100.0%
flip-+78.5%
metadata-eval78.5%
Applied egg-rr78.5%
Taylor expanded in y around -inf 78.0%
associate-*r/78.0%
cancel-sign-sub-inv78.0%
metadata-eval78.0%
distribute-lft-in78.0%
distribute-rgt1-in78.0%
metadata-eval78.0%
mul0-lft78.0%
metadata-eval78.0%
metadata-eval78.0%
metadata-eval78.0%
neg-mul-178.0%
distribute-lft-neg-in78.0%
metadata-eval78.0%
*-commutative78.0%
Simplified78.0%
Taylor expanded in x around 0 78.1%
associate-*r/78.1%
metadata-eval78.1%
Simplified78.1%
if -2.2e10 < y < 8.5000000000000007e-93Initial program 100.0%
Taylor expanded in x around inf 52.5%
mul-1-neg52.5%
Simplified52.5%
Taylor expanded in x around 0 52.5%
if 8.5000000000000007e-93 < y < 2.4499999999999999e-29Initial program 100.0%
Taylor expanded in x around 0 63.4%
associate-*r/63.4%
neg-mul-163.4%
Simplified63.4%
Taylor expanded in y around 0 63.4%
*-commutative63.4%
Simplified63.4%
Final simplification67.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))) (t_1 (/ x (- -2.0 x))))
(if (<= y -3.15e+72)
t_0
(if (<= y -4e+55)
-1.0
(if (<= y -40000000000.0)
(+ 1.0 (/ 2.0 y))
(if (<= y 1.1e-79)
t_1
(if (<= y 4.2e-28) (* y -0.5) (if (<= y 1.36e+42) t_1 t_0))))))))
double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double t_1 = x / (-2.0 - x);
double tmp;
if (y <= -3.15e+72) {
tmp = t_0;
} else if (y <= -4e+55) {
tmp = -1.0;
} else if (y <= -40000000000.0) {
tmp = 1.0 + (2.0 / y);
} else if (y <= 1.1e-79) {
tmp = t_1;
} else if (y <= 4.2e-28) {
tmp = y * -0.5;
} else if (y <= 1.36e+42) {
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 / y)
t_1 = x / ((-2.0d0) - x)
if (y <= (-3.15d+72)) then
tmp = t_0
else if (y <= (-4d+55)) then
tmp = -1.0d0
else if (y <= (-40000000000.0d0)) then
tmp = 1.0d0 + (2.0d0 / y)
else if (y <= 1.1d-79) then
tmp = t_1
else if (y <= 4.2d-28) then
tmp = y * (-0.5d0)
else if (y <= 1.36d+42) 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 / y);
double t_1 = x / (-2.0 - x);
double tmp;
if (y <= -3.15e+72) {
tmp = t_0;
} else if (y <= -4e+55) {
tmp = -1.0;
} else if (y <= -40000000000.0) {
tmp = 1.0 + (2.0 / y);
} else if (y <= 1.1e-79) {
tmp = t_1;
} else if (y <= 4.2e-28) {
tmp = y * -0.5;
} else if (y <= 1.36e+42) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 - (x / y) t_1 = x / (-2.0 - x) tmp = 0 if y <= -3.15e+72: tmp = t_0 elif y <= -4e+55: tmp = -1.0 elif y <= -40000000000.0: tmp = 1.0 + (2.0 / y) elif y <= 1.1e-79: tmp = t_1 elif y <= 4.2e-28: tmp = y * -0.5 elif y <= 1.36e+42: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 - Float64(x / y)) t_1 = Float64(x / Float64(-2.0 - x)) tmp = 0.0 if (y <= -3.15e+72) tmp = t_0; elseif (y <= -4e+55) tmp = -1.0; elseif (y <= -40000000000.0) tmp = Float64(1.0 + Float64(2.0 / y)); elseif (y <= 1.1e-79) tmp = t_1; elseif (y <= 4.2e-28) tmp = Float64(y * -0.5); elseif (y <= 1.36e+42) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 - (x / y); t_1 = x / (-2.0 - x); tmp = 0.0; if (y <= -3.15e+72) tmp = t_0; elseif (y <= -4e+55) tmp = -1.0; elseif (y <= -40000000000.0) tmp = 1.0 + (2.0 / y); elseif (y <= 1.1e-79) tmp = t_1; elseif (y <= 4.2e-28) tmp = y * -0.5; elseif (y <= 1.36e+42) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[(-2.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.15e+72], t$95$0, If[LessEqual[y, -4e+55], -1.0, If[LessEqual[y, -40000000000.0], N[(1.0 + N[(2.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1e-79], t$95$1, If[LessEqual[y, 4.2e-28], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.36e+42], t$95$1, t$95$0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
t_1 := \frac{x}{-2 - x}\\
\mathbf{if}\;y \leq -3.15 \cdot 10^{+72}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -4 \cdot 10^{+55}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq -40000000000:\\
\;\;\;\;1 + \frac{2}{y}\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-79}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-28}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.36 \cdot 10^{+42}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -3.14999999999999981e72 or 1.35999999999999999e42 < y Initial program 99.9%
Taylor expanded in y around inf 81.2%
neg-mul-181.2%
Simplified81.2%
Taylor expanded in x around 0 81.2%
mul-1-neg81.2%
unsub-neg81.2%
Simplified81.2%
if -3.14999999999999981e72 < y < -4.00000000000000004e55Initial program 100.0%
Taylor expanded in x around inf 100.0%
if -4.00000000000000004e55 < y < -4e10Initial program 100.0%
sub-neg100.0%
flip-+78.5%
metadata-eval78.5%
Applied egg-rr78.5%
Taylor expanded in y around -inf 78.0%
associate-*r/78.0%
cancel-sign-sub-inv78.0%
metadata-eval78.0%
distribute-lft-in78.0%
distribute-rgt1-in78.0%
metadata-eval78.0%
mul0-lft78.0%
metadata-eval78.0%
metadata-eval78.0%
metadata-eval78.0%
neg-mul-178.0%
distribute-lft-neg-in78.0%
metadata-eval78.0%
*-commutative78.0%
Simplified78.0%
Taylor expanded in x around 0 78.1%
associate-*r/78.1%
metadata-eval78.1%
Simplified78.1%
if -4e10 < y < 1.0999999999999999e-79 or 4.20000000000000013e-28 < y < 1.35999999999999999e42Initial program 100.0%
Taylor expanded in y around 0 76.3%
frac-2neg76.3%
div-inv76.1%
add-sqr-sqrt39.6%
sqrt-unprod23.0%
sqr-neg23.0%
sqrt-unprod1.5%
add-sqr-sqrt3.0%
sub-neg3.0%
add-sqr-sqrt1.5%
sqrt-unprod15.1%
sqr-neg15.1%
sqrt-unprod27.0%
add-sqr-sqrt54.8%
Applied egg-rr54.8%
neg-mul-154.8%
associate-*r/55.0%
*-rgt-identity55.0%
neg-mul-155.0%
distribute-neg-in55.0%
metadata-eval55.0%
unsub-neg55.0%
Simplified55.0%
if 1.0999999999999999e-79 < y < 4.20000000000000013e-28Initial program 100.0%
Taylor expanded in x around 0 68.7%
associate-*r/68.7%
neg-mul-168.7%
Simplified68.7%
Taylor expanded in y around 0 68.7%
*-commutative68.7%
Simplified68.7%
Final simplification67.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- 1.0 (/ x y))))
(if (<= y -2.6e+72)
t_0
(if (<= y -1.2e+55)
-1.0
(if (<= y -85000000000.0)
(+ 1.0 (/ 2.0 y))
(if (<= y 6e-80)
(/ x (- 2.0 x))
(if (<= y 2.4e-29)
(* y -0.5)
(if (<= y 1.25e+42) (/ x (- -2.0 x)) t_0))))))))
double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -2.6e+72) {
tmp = t_0;
} else if (y <= -1.2e+55) {
tmp = -1.0;
} else if (y <= -85000000000.0) {
tmp = 1.0 + (2.0 / y);
} else if (y <= 6e-80) {
tmp = x / (2.0 - x);
} else if (y <= 2.4e-29) {
tmp = y * -0.5;
} else if (y <= 1.25e+42) {
tmp = x / (-2.0 - x);
} 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) :: tmp
t_0 = 1.0d0 - (x / y)
if (y <= (-2.6d+72)) then
tmp = t_0
else if (y <= (-1.2d+55)) then
tmp = -1.0d0
else if (y <= (-85000000000.0d0)) then
tmp = 1.0d0 + (2.0d0 / y)
else if (y <= 6d-80) then
tmp = x / (2.0d0 - x)
else if (y <= 2.4d-29) then
tmp = y * (-0.5d0)
else if (y <= 1.25d+42) then
tmp = x / ((-2.0d0) - x)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 - (x / y);
double tmp;
if (y <= -2.6e+72) {
tmp = t_0;
} else if (y <= -1.2e+55) {
tmp = -1.0;
} else if (y <= -85000000000.0) {
tmp = 1.0 + (2.0 / y);
} else if (y <= 6e-80) {
tmp = x / (2.0 - x);
} else if (y <= 2.4e-29) {
tmp = y * -0.5;
} else if (y <= 1.25e+42) {
tmp = x / (-2.0 - x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 - (x / y) tmp = 0 if y <= -2.6e+72: tmp = t_0 elif y <= -1.2e+55: tmp = -1.0 elif y <= -85000000000.0: tmp = 1.0 + (2.0 / y) elif y <= 6e-80: tmp = x / (2.0 - x) elif y <= 2.4e-29: tmp = y * -0.5 elif y <= 1.25e+42: tmp = x / (-2.0 - x) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 - Float64(x / y)) tmp = 0.0 if (y <= -2.6e+72) tmp = t_0; elseif (y <= -1.2e+55) tmp = -1.0; elseif (y <= -85000000000.0) tmp = Float64(1.0 + Float64(2.0 / y)); elseif (y <= 6e-80) tmp = Float64(x / Float64(2.0 - x)); elseif (y <= 2.4e-29) tmp = Float64(y * -0.5); elseif (y <= 1.25e+42) tmp = Float64(x / Float64(-2.0 - x)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 - (x / y); tmp = 0.0; if (y <= -2.6e+72) tmp = t_0; elseif (y <= -1.2e+55) tmp = -1.0; elseif (y <= -85000000000.0) tmp = 1.0 + (2.0 / y); elseif (y <= 6e-80) tmp = x / (2.0 - x); elseif (y <= 2.4e-29) tmp = y * -0.5; elseif (y <= 1.25e+42) tmp = x / (-2.0 - x); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.6e+72], t$95$0, If[LessEqual[y, -1.2e+55], -1.0, If[LessEqual[y, -85000000000.0], N[(1.0 + N[(2.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6e-80], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.4e-29], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.25e+42], N[(x / N[(-2.0 - x), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{x}{y}\\
\mathbf{if}\;y \leq -2.6 \cdot 10^{+72}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -1.2 \cdot 10^{+55}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq -85000000000:\\
\;\;\;\;1 + \frac{2}{y}\\
\mathbf{elif}\;y \leq 6 \cdot 10^{-80}:\\
\;\;\;\;\frac{x}{2 - x}\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{-29}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+42}:\\
\;\;\;\;\frac{x}{-2 - x}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -2.59999999999999981e72 or 1.25000000000000002e42 < y Initial program 99.9%
Taylor expanded in y around inf 81.2%
neg-mul-181.2%
Simplified81.2%
Taylor expanded in x around 0 81.2%
mul-1-neg81.2%
unsub-neg81.2%
Simplified81.2%
if -2.59999999999999981e72 < y < -1.2e55Initial program 100.0%
Taylor expanded in x around inf 100.0%
if -1.2e55 < y < -8.5e10Initial program 100.0%
sub-neg100.0%
flip-+78.5%
metadata-eval78.5%
Applied egg-rr78.5%
Taylor expanded in y around -inf 78.0%
associate-*r/78.0%
cancel-sign-sub-inv78.0%
metadata-eval78.0%
distribute-lft-in78.0%
distribute-rgt1-in78.0%
metadata-eval78.0%
mul0-lft78.0%
metadata-eval78.0%
metadata-eval78.0%
metadata-eval78.0%
neg-mul-178.0%
distribute-lft-neg-in78.0%
metadata-eval78.0%
*-commutative78.0%
Simplified78.0%
Taylor expanded in x around 0 78.1%
associate-*r/78.1%
metadata-eval78.1%
Simplified78.1%
if -8.5e10 < y < 6.00000000000000014e-80Initial program 100.0%
Taylor expanded in y around 0 76.1%
if 6.00000000000000014e-80 < y < 2.39999999999999992e-29Initial program 100.0%
Taylor expanded in x around 0 68.7%
associate-*r/68.7%
neg-mul-168.7%
Simplified68.7%
Taylor expanded in y around 0 68.7%
*-commutative68.7%
Simplified68.7%
if 2.39999999999999992e-29 < y < 1.25000000000000002e42Initial program 100.0%
Taylor expanded in y around 0 77.5%
frac-2neg77.5%
div-inv77.4%
add-sqr-sqrt53.8%
sqrt-unprod25.1%
sqr-neg25.1%
sqrt-unprod1.1%
add-sqr-sqrt2.4%
sub-neg2.4%
add-sqr-sqrt1.3%
sqrt-unprod3.2%
sqr-neg3.2%
sqrt-unprod23.7%
add-sqr-sqrt78.0%
Applied egg-rr78.0%
neg-mul-178.0%
associate-*r/78.1%
*-rgt-identity78.1%
neg-mul-178.1%
distribute-neg-in78.1%
metadata-eval78.1%
unsub-neg78.1%
Simplified78.1%
Final simplification78.3%
(FPCore (x y)
:precision binary64
(if (<= y -7e+72)
1.0
(if (<= y -8e+55)
-1.0
(if (<= y -85000000000.0)
1.0
(if (<= y 2.05e-82)
-1.0
(if (<= y 1.8e-29) (* y -0.5) (if (<= y 3.1e+43) -1.0 1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -7e+72) {
tmp = 1.0;
} else if (y <= -8e+55) {
tmp = -1.0;
} else if (y <= -85000000000.0) {
tmp = 1.0;
} else if (y <= 2.05e-82) {
tmp = -1.0;
} else if (y <= 1.8e-29) {
tmp = y * -0.5;
} else if (y <= 3.1e+43) {
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 <= (-7d+72)) then
tmp = 1.0d0
else if (y <= (-8d+55)) then
tmp = -1.0d0
else if (y <= (-85000000000.0d0)) then
tmp = 1.0d0
else if (y <= 2.05d-82) then
tmp = -1.0d0
else if (y <= 1.8d-29) then
tmp = y * (-0.5d0)
else if (y <= 3.1d+43) 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 <= -7e+72) {
tmp = 1.0;
} else if (y <= -8e+55) {
tmp = -1.0;
} else if (y <= -85000000000.0) {
tmp = 1.0;
} else if (y <= 2.05e-82) {
tmp = -1.0;
} else if (y <= 1.8e-29) {
tmp = y * -0.5;
} else if (y <= 3.1e+43) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7e+72: tmp = 1.0 elif y <= -8e+55: tmp = -1.0 elif y <= -85000000000.0: tmp = 1.0 elif y <= 2.05e-82: tmp = -1.0 elif y <= 1.8e-29: tmp = y * -0.5 elif y <= 3.1e+43: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -7e+72) tmp = 1.0; elseif (y <= -8e+55) tmp = -1.0; elseif (y <= -85000000000.0) tmp = 1.0; elseif (y <= 2.05e-82) tmp = -1.0; elseif (y <= 1.8e-29) tmp = Float64(y * -0.5); elseif (y <= 3.1e+43) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -7e+72) tmp = 1.0; elseif (y <= -8e+55) tmp = -1.0; elseif (y <= -85000000000.0) tmp = 1.0; elseif (y <= 2.05e-82) tmp = -1.0; elseif (y <= 1.8e-29) tmp = y * -0.5; elseif (y <= 3.1e+43) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7e+72], 1.0, If[LessEqual[y, -8e+55], -1.0, If[LessEqual[y, -85000000000.0], 1.0, If[LessEqual[y, 2.05e-82], -1.0, If[LessEqual[y, 1.8e-29], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 3.1e+43], -1.0, 1.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{+72}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -8 \cdot 10^{+55}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq -85000000000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 2.05 \cdot 10^{-82}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-29}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+43}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -7.0000000000000002e72 or -8.00000000000000008e55 < y < -8.5e10 or 3.1000000000000002e43 < y Initial program 99.9%
Taylor expanded in y around inf 79.9%
if -7.0000000000000002e72 < y < -8.00000000000000008e55 or -8.5e10 < y < 2.04999999999999998e-82 or 1.79999999999999987e-29 < y < 3.1000000000000002e43Initial program 100.0%
Taylor expanded in x around inf 56.4%
if 2.04999999999999998e-82 < y < 1.79999999999999987e-29Initial program 100.0%
Taylor expanded in x around 0 68.7%
associate-*r/68.7%
neg-mul-168.7%
Simplified68.7%
Taylor expanded in y around 0 68.7%
*-commutative68.7%
Simplified68.7%
Final simplification67.2%
(FPCore (x y)
:precision binary64
(if (<= y -4.4e+72)
1.0
(if (<= y -2.8e+56)
-1.0
(if (<= y -22000000000.0)
(+ 1.0 (/ 2.0 y))
(if (<= y 2.9e-86)
-1.0
(if (<= y 2.6e-31) (* y -0.5) (if (<= y 1.95e+42) -1.0 1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -4.4e+72) {
tmp = 1.0;
} else if (y <= -2.8e+56) {
tmp = -1.0;
} else if (y <= -22000000000.0) {
tmp = 1.0 + (2.0 / y);
} else if (y <= 2.9e-86) {
tmp = -1.0;
} else if (y <= 2.6e-31) {
tmp = y * -0.5;
} else if (y <= 1.95e+42) {
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 <= (-4.4d+72)) then
tmp = 1.0d0
else if (y <= (-2.8d+56)) then
tmp = -1.0d0
else if (y <= (-22000000000.0d0)) then
tmp = 1.0d0 + (2.0d0 / y)
else if (y <= 2.9d-86) then
tmp = -1.0d0
else if (y <= 2.6d-31) then
tmp = y * (-0.5d0)
else if (y <= 1.95d+42) 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 <= -4.4e+72) {
tmp = 1.0;
} else if (y <= -2.8e+56) {
tmp = -1.0;
} else if (y <= -22000000000.0) {
tmp = 1.0 + (2.0 / y);
} else if (y <= 2.9e-86) {
tmp = -1.0;
} else if (y <= 2.6e-31) {
tmp = y * -0.5;
} else if (y <= 1.95e+42) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4.4e+72: tmp = 1.0 elif y <= -2.8e+56: tmp = -1.0 elif y <= -22000000000.0: tmp = 1.0 + (2.0 / y) elif y <= 2.9e-86: tmp = -1.0 elif y <= 2.6e-31: tmp = y * -0.5 elif y <= 1.95e+42: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -4.4e+72) tmp = 1.0; elseif (y <= -2.8e+56) tmp = -1.0; elseif (y <= -22000000000.0) tmp = Float64(1.0 + Float64(2.0 / y)); elseif (y <= 2.9e-86) tmp = -1.0; elseif (y <= 2.6e-31) tmp = Float64(y * -0.5); elseif (y <= 1.95e+42) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -4.4e+72) tmp = 1.0; elseif (y <= -2.8e+56) tmp = -1.0; elseif (y <= -22000000000.0) tmp = 1.0 + (2.0 / y); elseif (y <= 2.9e-86) tmp = -1.0; elseif (y <= 2.6e-31) tmp = y * -0.5; elseif (y <= 1.95e+42) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -4.4e+72], 1.0, If[LessEqual[y, -2.8e+56], -1.0, If[LessEqual[y, -22000000000.0], N[(1.0 + N[(2.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.9e-86], -1.0, If[LessEqual[y, 2.6e-31], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 1.95e+42], -1.0, 1.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{+72}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -2.8 \cdot 10^{+56}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq -22000000000:\\
\;\;\;\;1 + \frac{2}{y}\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{-86}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{-31}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{+42}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -4.4e72 or 1.94999999999999985e42 < y Initial program 99.9%
Taylor expanded in y around inf 80.6%
if -4.4e72 < y < -2.80000000000000008e56 or -2.2e10 < y < 2.8999999999999999e-86 or 2.59999999999999995e-31 < y < 1.94999999999999985e42Initial program 100.0%
Taylor expanded in x around inf 56.4%
if -2.80000000000000008e56 < y < -2.2e10Initial program 100.0%
sub-neg100.0%
flip-+78.5%
metadata-eval78.5%
Applied egg-rr78.5%
Taylor expanded in y around -inf 78.0%
associate-*r/78.0%
cancel-sign-sub-inv78.0%
metadata-eval78.0%
distribute-lft-in78.0%
distribute-rgt1-in78.0%
metadata-eval78.0%
mul0-lft78.0%
metadata-eval78.0%
metadata-eval78.0%
metadata-eval78.0%
neg-mul-178.0%
distribute-lft-neg-in78.0%
metadata-eval78.0%
*-commutative78.0%
Simplified78.0%
Taylor expanded in x around 0 78.1%
associate-*r/78.1%
metadata-eval78.1%
Simplified78.1%
if 2.8999999999999999e-86 < y < 2.59999999999999995e-31Initial program 100.0%
Taylor expanded in x around 0 68.7%
associate-*r/68.7%
neg-mul-168.7%
Simplified68.7%
Taylor expanded in y around 0 68.7%
*-commutative68.7%
Simplified68.7%
Final simplification67.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (- 2.0 x))))
(if (<= x -5.1e-42)
t_0
(if (<= x 1.45e-34)
(/ y (+ y -2.0))
(if (<= x 8.5e+48)
t_0
(if (<= x 8.2e+80) (+ 1.0 (/ 2.0 y)) (+ (/ y x) -1.0)))))))
double code(double x, double y) {
double t_0 = x / (2.0 - x);
double tmp;
if (x <= -5.1e-42) {
tmp = t_0;
} else if (x <= 1.45e-34) {
tmp = y / (y + -2.0);
} else if (x <= 8.5e+48) {
tmp = t_0;
} else if (x <= 8.2e+80) {
tmp = 1.0 + (2.0 / y);
} else {
tmp = (y / x) + -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 (x <= (-5.1d-42)) then
tmp = t_0
else if (x <= 1.45d-34) then
tmp = y / (y + (-2.0d0))
else if (x <= 8.5d+48) then
tmp = t_0
else if (x <= 8.2d+80) then
tmp = 1.0d0 + (2.0d0 / y)
else
tmp = (y / x) + (-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 (x <= -5.1e-42) {
tmp = t_0;
} else if (x <= 1.45e-34) {
tmp = y / (y + -2.0);
} else if (x <= 8.5e+48) {
tmp = t_0;
} else if (x <= 8.2e+80) {
tmp = 1.0 + (2.0 / y);
} else {
tmp = (y / x) + -1.0;
}
return tmp;
}
def code(x, y): t_0 = x / (2.0 - x) tmp = 0 if x <= -5.1e-42: tmp = t_0 elif x <= 1.45e-34: tmp = y / (y + -2.0) elif x <= 8.5e+48: tmp = t_0 elif x <= 8.2e+80: tmp = 1.0 + (2.0 / y) else: tmp = (y / x) + -1.0 return tmp
function code(x, y) t_0 = Float64(x / Float64(2.0 - x)) tmp = 0.0 if (x <= -5.1e-42) tmp = t_0; elseif (x <= 1.45e-34) tmp = Float64(y / Float64(y + -2.0)); elseif (x <= 8.5e+48) tmp = t_0; elseif (x <= 8.2e+80) tmp = Float64(1.0 + Float64(2.0 / y)); else tmp = Float64(Float64(y / x) + -1.0); end return tmp end
function tmp_2 = code(x, y) t_0 = x / (2.0 - x); tmp = 0.0; if (x <= -5.1e-42) tmp = t_0; elseif (x <= 1.45e-34) tmp = y / (y + -2.0); elseif (x <= 8.5e+48) tmp = t_0; elseif (x <= 8.2e+80) tmp = 1.0 + (2.0 / y); else tmp = (y / x) + -1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.1e-42], t$95$0, If[LessEqual[x, 1.45e-34], N[(y / N[(y + -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.5e+48], t$95$0, If[LessEqual[x, 8.2e+80], N[(1.0 + N[(2.0 / y), $MachinePrecision]), $MachinePrecision], N[(N[(y / x), $MachinePrecision] + -1.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{2 - x}\\
\mathbf{if}\;x \leq -5.1 \cdot 10^{-42}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{-34}:\\
\;\;\;\;\frac{y}{y + -2}\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{+48}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{+80}:\\
\;\;\;\;1 + \frac{2}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{x} + -1\\
\end{array}
\end{array}
if x < -5.1e-42 or 1.4500000000000001e-34 < x < 8.5000000000000001e48Initial program 99.9%
Taylor expanded in y around 0 70.4%
if -5.1e-42 < x < 1.4500000000000001e-34Initial program 100.0%
Taylor expanded in x around 0 82.1%
associate-*r/82.1%
neg-mul-182.1%
Simplified82.1%
frac-2neg82.1%
div-inv82.0%
remove-double-neg82.0%
sub-neg82.0%
distribute-neg-in82.0%
metadata-eval82.0%
remove-double-neg82.0%
Applied egg-rr82.0%
associate-*r/82.1%
*-rgt-identity82.1%
+-commutative82.1%
Simplified82.1%
if 8.5000000000000001e48 < x < 8.20000000000000003e80Initial program 100.0%
sub-neg100.0%
flip-+51.6%
metadata-eval51.6%
Applied egg-rr51.6%
Taylor expanded in y around -inf 67.3%
associate-*r/67.3%
cancel-sign-sub-inv67.3%
metadata-eval67.3%
distribute-lft-in67.3%
distribute-rgt1-in67.3%
metadata-eval67.3%
mul0-lft67.3%
metadata-eval67.3%
metadata-eval67.3%
metadata-eval67.3%
neg-mul-167.3%
distribute-lft-neg-in67.3%
metadata-eval67.3%
*-commutative67.3%
Simplified67.3%
Taylor expanded in x around 0 68.1%
associate-*r/68.1%
metadata-eval68.1%
Simplified68.1%
if 8.20000000000000003e80 < x Initial program 99.9%
Taylor expanded in x around inf 87.0%
mul-1-neg87.0%
Simplified87.0%
Taylor expanded in x around 0 87.0%
Final simplification78.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (/ y x) -1.0)))
(if (<= x -6.2e+76)
t_0
(if (<= x 0.32)
(/ (- x y) (- 2.0 y))
(if (<= x 3e+50)
(/ x (- 2.0 x))
(if (<= x 8e+80) (+ 1.0 (/ 2.0 y)) t_0))))))
double code(double x, double y) {
double t_0 = (y / x) + -1.0;
double tmp;
if (x <= -6.2e+76) {
tmp = t_0;
} else if (x <= 0.32) {
tmp = (x - y) / (2.0 - y);
} else if (x <= 3e+50) {
tmp = x / (2.0 - x);
} else if (x <= 8e+80) {
tmp = 1.0 + (2.0 / y);
} 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) :: tmp
t_0 = (y / x) + (-1.0d0)
if (x <= (-6.2d+76)) then
tmp = t_0
else if (x <= 0.32d0) then
tmp = (x - y) / (2.0d0 - y)
else if (x <= 3d+50) then
tmp = x / (2.0d0 - x)
else if (x <= 8d+80) then
tmp = 1.0d0 + (2.0d0 / y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y / x) + -1.0;
double tmp;
if (x <= -6.2e+76) {
tmp = t_0;
} else if (x <= 0.32) {
tmp = (x - y) / (2.0 - y);
} else if (x <= 3e+50) {
tmp = x / (2.0 - x);
} else if (x <= 8e+80) {
tmp = 1.0 + (2.0 / y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (y / x) + -1.0 tmp = 0 if x <= -6.2e+76: tmp = t_0 elif x <= 0.32: tmp = (x - y) / (2.0 - y) elif x <= 3e+50: tmp = x / (2.0 - x) elif x <= 8e+80: tmp = 1.0 + (2.0 / y) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(y / x) + -1.0) tmp = 0.0 if (x <= -6.2e+76) tmp = t_0; elseif (x <= 0.32) tmp = Float64(Float64(x - y) / Float64(2.0 - y)); elseif (x <= 3e+50) tmp = Float64(x / Float64(2.0 - x)); elseif (x <= 8e+80) tmp = Float64(1.0 + Float64(2.0 / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (y / x) + -1.0; tmp = 0.0; if (x <= -6.2e+76) tmp = t_0; elseif (x <= 0.32) tmp = (x - y) / (2.0 - y); elseif (x <= 3e+50) tmp = x / (2.0 - x); elseif (x <= 8e+80) tmp = 1.0 + (2.0 / y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y / x), $MachinePrecision] + -1.0), $MachinePrecision]}, If[LessEqual[x, -6.2e+76], t$95$0, If[LessEqual[x, 0.32], N[(N[(x - y), $MachinePrecision] / N[(2.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3e+50], N[(x / N[(2.0 - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8e+80], N[(1.0 + N[(2.0 / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{x} + -1\\
\mathbf{if}\;x \leq -6.2 \cdot 10^{+76}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 0.32:\\
\;\;\;\;\frac{x - y}{2 - y}\\
\mathbf{elif}\;x \leq 3 \cdot 10^{+50}:\\
\;\;\;\;\frac{x}{2 - x}\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+80}:\\
\;\;\;\;1 + \frac{2}{y}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -6.20000000000000023e76 or 8e80 < x Initial program 99.9%
Taylor expanded in x around inf 78.9%
mul-1-neg78.9%
Simplified78.9%
Taylor expanded in x around 0 78.9%
if -6.20000000000000023e76 < x < 0.320000000000000007Initial program 100.0%
Taylor expanded in x around 0 96.4%
if 0.320000000000000007 < x < 2.9999999999999998e50Initial program 100.0%
Taylor expanded in y around 0 73.2%
if 2.9999999999999998e50 < x < 8e80Initial program 100.0%
sub-neg100.0%
flip-+51.6%
metadata-eval51.6%
Applied egg-rr51.6%
Taylor expanded in y around -inf 67.3%
associate-*r/67.3%
cancel-sign-sub-inv67.3%
metadata-eval67.3%
distribute-lft-in67.3%
distribute-rgt1-in67.3%
metadata-eval67.3%
mul0-lft67.3%
metadata-eval67.3%
metadata-eval67.3%
metadata-eval67.3%
neg-mul-167.3%
distribute-lft-neg-in67.3%
metadata-eval67.3%
*-commutative67.3%
Simplified67.3%
Taylor expanded in x around 0 68.1%
associate-*r/68.1%
metadata-eval68.1%
Simplified68.1%
Final simplification87.1%
(FPCore (x y)
:precision binary64
(if (<= y -5e+72)
1.0
(if (<= y -2e+56)
-1.0
(if (<= y -80000000000.0) 1.0 (if (<= y 5e+42) -1.0 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= -5e+72) {
tmp = 1.0;
} else if (y <= -2e+56) {
tmp = -1.0;
} else if (y <= -80000000000.0) {
tmp = 1.0;
} else if (y <= 5e+42) {
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 <= (-5d+72)) then
tmp = 1.0d0
else if (y <= (-2d+56)) then
tmp = -1.0d0
else if (y <= (-80000000000.0d0)) then
tmp = 1.0d0
else if (y <= 5d+42) 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 <= -5e+72) {
tmp = 1.0;
} else if (y <= -2e+56) {
tmp = -1.0;
} else if (y <= -80000000000.0) {
tmp = 1.0;
} else if (y <= 5e+42) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5e+72: tmp = 1.0 elif y <= -2e+56: tmp = -1.0 elif y <= -80000000000.0: tmp = 1.0 elif y <= 5e+42: tmp = -1.0 else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (y <= -5e+72) tmp = 1.0; elseif (y <= -2e+56) tmp = -1.0; elseif (y <= -80000000000.0) tmp = 1.0; elseif (y <= 5e+42) tmp = -1.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5e+72) tmp = 1.0; elseif (y <= -2e+56) tmp = -1.0; elseif (y <= -80000000000.0) tmp = 1.0; elseif (y <= 5e+42) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5e+72], 1.0, If[LessEqual[y, -2e+56], -1.0, If[LessEqual[y, -80000000000.0], 1.0, If[LessEqual[y, 5e+42], -1.0, 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+72}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -2 \cdot 10^{+56}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \leq -80000000000:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+42}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -4.99999999999999992e72 or -2.00000000000000018e56 < y < -8e10 or 5.00000000000000007e42 < y Initial program 99.9%
Taylor expanded in y around inf 79.9%
if -4.99999999999999992e72 < y < -2.00000000000000018e56 or -8e10 < y < 5.00000000000000007e42Initial program 100.0%
Taylor expanded in x around inf 54.1%
Final simplification65.2%
(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 -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%
Taylor expanded in x around inf 38.3%
Final simplification38.3%
(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 2024019
(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))))