
(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 13 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 99.9%
associate--r+99.9%
Simplified99.9%
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 (/ x (- 2.0 x))))
(if (<= y -7.9e+139)
1.0
(if (<= y -2.05e+55)
(+ -1.0 (/ y x))
(if (<= y -4.9e+30)
1.0
(if (<= y -9.5e-35)
t_0
(if (<= y -5.4e-79)
(* y -0.5)
(if (<= y 6e-206)
t_0
(if (<= y 1.55e-151)
(* y -0.5)
(if (<= y 2.6e+30) t_0 1.0))))))))))
double code(double x, double y) {
double t_0 = x / (2.0 - x);
double tmp;
if (y <= -7.9e+139) {
tmp = 1.0;
} else if (y <= -2.05e+55) {
tmp = -1.0 + (y / x);
} else if (y <= -4.9e+30) {
tmp = 1.0;
} else if (y <= -9.5e-35) {
tmp = t_0;
} else if (y <= -5.4e-79) {
tmp = y * -0.5;
} else if (y <= 6e-206) {
tmp = t_0;
} else if (y <= 1.55e-151) {
tmp = y * -0.5;
} else if (y <= 2.6e+30) {
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 <= (-7.9d+139)) then
tmp = 1.0d0
else if (y <= (-2.05d+55)) then
tmp = (-1.0d0) + (y / x)
else if (y <= (-4.9d+30)) then
tmp = 1.0d0
else if (y <= (-9.5d-35)) then
tmp = t_0
else if (y <= (-5.4d-79)) then
tmp = y * (-0.5d0)
else if (y <= 6d-206) then
tmp = t_0
else if (y <= 1.55d-151) then
tmp = y * (-0.5d0)
else if (y <= 2.6d+30) 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 <= -7.9e+139) {
tmp = 1.0;
} else if (y <= -2.05e+55) {
tmp = -1.0 + (y / x);
} else if (y <= -4.9e+30) {
tmp = 1.0;
} else if (y <= -9.5e-35) {
tmp = t_0;
} else if (y <= -5.4e-79) {
tmp = y * -0.5;
} else if (y <= 6e-206) {
tmp = t_0;
} else if (y <= 1.55e-151) {
tmp = y * -0.5;
} else if (y <= 2.6e+30) {
tmp = t_0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = x / (2.0 - x) tmp = 0 if y <= -7.9e+139: tmp = 1.0 elif y <= -2.05e+55: tmp = -1.0 + (y / x) elif y <= -4.9e+30: tmp = 1.0 elif y <= -9.5e-35: tmp = t_0 elif y <= -5.4e-79: tmp = y * -0.5 elif y <= 6e-206: tmp = t_0 elif y <= 1.55e-151: tmp = y * -0.5 elif y <= 2.6e+30: 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 <= -7.9e+139) tmp = 1.0; elseif (y <= -2.05e+55) tmp = Float64(-1.0 + Float64(y / x)); elseif (y <= -4.9e+30) tmp = 1.0; elseif (y <= -9.5e-35) tmp = t_0; elseif (y <= -5.4e-79) tmp = Float64(y * -0.5); elseif (y <= 6e-206) tmp = t_0; elseif (y <= 1.55e-151) tmp = Float64(y * -0.5); elseif (y <= 2.6e+30) 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 <= -7.9e+139) tmp = 1.0; elseif (y <= -2.05e+55) tmp = -1.0 + (y / x); elseif (y <= -4.9e+30) tmp = 1.0; elseif (y <= -9.5e-35) tmp = t_0; elseif (y <= -5.4e-79) tmp = y * -0.5; elseif (y <= 6e-206) tmp = t_0; elseif (y <= 1.55e-151) tmp = y * -0.5; elseif (y <= 2.6e+30) 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, -7.9e+139], 1.0, If[LessEqual[y, -2.05e+55], N[(-1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -4.9e+30], 1.0, If[LessEqual[y, -9.5e-35], t$95$0, If[LessEqual[y, -5.4e-79], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 6e-206], t$95$0, If[LessEqual[y, 1.55e-151], N[(y * -0.5), $MachinePrecision], If[LessEqual[y, 2.6e+30], t$95$0, 1.0]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{2 - x}\\
\mathbf{if}\;y \leq -7.9 \cdot 10^{+139}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -2.05 \cdot 10^{+55}:\\
\;\;\;\;-1 + \frac{y}{x}\\
\mathbf{elif}\;y \leq -4.9 \cdot 10^{+30}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq -9.5 \cdot 10^{-35}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -5.4 \cdot 10^{-79}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 6 \cdot 10^{-206}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{-151}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+30}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -7.90000000000000019e139 or -2.04999999999999991e55 < y < -4.89999999999999984e30 or 2.59999999999999988e30 < y Initial program 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in y around inf 81.5%
if -7.90000000000000019e139 < y < -2.04999999999999991e55Initial program 99.7%
associate--r+99.7%
Simplified99.7%
clear-num99.7%
associate-/r/99.2%
associate--l-99.2%
Applied egg-rr99.2%
Taylor expanded in x around inf 62.0%
Taylor expanded in x around 0 62.5%
if -4.89999999999999984e30 < y < -9.5000000000000003e-35 or -5.4000000000000004e-79 < y < 6.0000000000000004e-206 or 1.54999999999999992e-151 < y < 2.59999999999999988e30Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around 0 71.1%
if -9.5000000000000003e-35 < y < -5.4000000000000004e-79 or 6.0000000000000004e-206 < y < 1.54999999999999992e-151Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around 0 75.9%
mul-1-neg75.9%
distribute-neg-frac75.9%
Simplified75.9%
Taylor expanded in y around 0 75.9%
*-commutative75.9%
Simplified75.9%
Final simplification74.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ -1.0 (/ y x))))
(if (<= x -2.9e+17)
t_0
(if (<= x -2.5e-189)
(- 1.0 (/ 2.0 y))
(if (<= x -6.2e-269)
(* y -0.5)
(if (<= x -5.5e-304)
1.0
(if (<= x 1.4e-207) (* y -0.5) (if (<= x 5.2e+14) 1.0 t_0))))))))
double code(double x, double y) {
double t_0 = -1.0 + (y / x);
double tmp;
if (x <= -2.9e+17) {
tmp = t_0;
} else if (x <= -2.5e-189) {
tmp = 1.0 - (2.0 / y);
} else if (x <= -6.2e-269) {
tmp = y * -0.5;
} else if (x <= -5.5e-304) {
tmp = 1.0;
} else if (x <= 1.4e-207) {
tmp = y * -0.5;
} else if (x <= 5.2e+14) {
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) + (y / x)
if (x <= (-2.9d+17)) then
tmp = t_0
else if (x <= (-2.5d-189)) then
tmp = 1.0d0 - (2.0d0 / y)
else if (x <= (-6.2d-269)) then
tmp = y * (-0.5d0)
else if (x <= (-5.5d-304)) then
tmp = 1.0d0
else if (x <= 1.4d-207) then
tmp = y * (-0.5d0)
else if (x <= 5.2d+14) 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 + (y / x);
double tmp;
if (x <= -2.9e+17) {
tmp = t_0;
} else if (x <= -2.5e-189) {
tmp = 1.0 - (2.0 / y);
} else if (x <= -6.2e-269) {
tmp = y * -0.5;
} else if (x <= -5.5e-304) {
tmp = 1.0;
} else if (x <= 1.4e-207) {
tmp = y * -0.5;
} else if (x <= 5.2e+14) {
tmp = 1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = -1.0 + (y / x) tmp = 0 if x <= -2.9e+17: tmp = t_0 elif x <= -2.5e-189: tmp = 1.0 - (2.0 / y) elif x <= -6.2e-269: tmp = y * -0.5 elif x <= -5.5e-304: tmp = 1.0 elif x <= 1.4e-207: tmp = y * -0.5 elif x <= 5.2e+14: tmp = 1.0 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(-1.0 + Float64(y / x)) tmp = 0.0 if (x <= -2.9e+17) tmp = t_0; elseif (x <= -2.5e-189) tmp = Float64(1.0 - Float64(2.0 / y)); elseif (x <= -6.2e-269) tmp = Float64(y * -0.5); elseif (x <= -5.5e-304) tmp = 1.0; elseif (x <= 1.4e-207) tmp = Float64(y * -0.5); elseif (x <= 5.2e+14) tmp = 1.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = -1.0 + (y / x); tmp = 0.0; if (x <= -2.9e+17) tmp = t_0; elseif (x <= -2.5e-189) tmp = 1.0 - (2.0 / y); elseif (x <= -6.2e-269) tmp = y * -0.5; elseif (x <= -5.5e-304) tmp = 1.0; elseif (x <= 1.4e-207) tmp = y * -0.5; elseif (x <= 5.2e+14) tmp = 1.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(-1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.9e+17], t$95$0, If[LessEqual[x, -2.5e-189], N[(1.0 - N[(2.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6.2e-269], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, -5.5e-304], 1.0, If[LessEqual[x, 1.4e-207], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 5.2e+14], 1.0, t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -1 + \frac{y}{x}\\
\mathbf{if}\;x \leq -2.9 \cdot 10^{+17}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -2.5 \cdot 10^{-189}:\\
\;\;\;\;1 - \frac{2}{y}\\
\mathbf{elif}\;x \leq -6.2 \cdot 10^{-269}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq -5.5 \cdot 10^{-304}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{-207}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{+14}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -2.9e17 or 5.2e14 < x Initial program 99.9%
associate--r+99.9%
Simplified99.9%
clear-num99.9%
associate-/r/99.7%
associate--l-99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 80.1%
Taylor expanded in x around 0 80.4%
if -2.9e17 < x < -2.4999999999999999e-189Initial program 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in x around 0 71.3%
mul-1-neg71.3%
distribute-neg-frac71.3%
Simplified71.3%
frac-2neg71.3%
div-inv71.2%
remove-double-neg71.2%
sub-neg71.2%
distribute-neg-in71.2%
metadata-eval71.2%
remove-double-neg71.2%
Applied egg-rr71.2%
associate-*r/71.3%
*-rgt-identity71.3%
+-commutative71.3%
Simplified71.3%
frac-2neg71.3%
+-commutative71.3%
distribute-neg-in71.3%
metadata-eval71.3%
add-sqr-sqrt29.7%
sqrt-unprod27.3%
sqr-neg27.3%
sqrt-unprod12.3%
add-sqr-sqrt17.2%
*-un-lft-identity17.2%
add-cube-cbrt16.8%
times-frac16.8%
cbrt-unprod16.8%
sqr-neg16.8%
cbrt-unprod16.8%
pow216.8%
Applied egg-rr54.6%
/-rgt-identity54.6%
associate-*r/54.7%
unpow254.7%
rem-3cbrt-lft55.6%
Simplified55.6%
Taylor expanded in y around inf 55.2%
associate-*r/55.2%
metadata-eval55.2%
Simplified55.2%
if -2.4999999999999999e-189 < x < -6.19999999999999933e-269 or -5.50000000000000035e-304 < x < 1.39999999999999996e-207Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around 0 95.0%
mul-1-neg95.0%
distribute-neg-frac95.0%
Simplified95.0%
Taylor expanded in y around 0 63.9%
*-commutative63.9%
Simplified63.9%
if -6.19999999999999933e-269 < x < -5.50000000000000035e-304 or 1.39999999999999996e-207 < x < 5.2e14Initial program 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in y around inf 60.7%
Final simplification69.2%
(FPCore (x y)
:precision binary64
(if (<= x -7e+18)
(/ (- y x) x)
(if (<= x -3.1e-25)
(+ 1.0 (/ (- (- 2.0 x) x) y))
(if (<= x -7.2e-38)
(* x 0.5)
(if (<= x 4100000000000.0)
(/ y (+ y -2.0))
(- -1.0 (/ y (- 2.0 (+ x y)))))))))
double code(double x, double y) {
double tmp;
if (x <= -7e+18) {
tmp = (y - x) / x;
} else if (x <= -3.1e-25) {
tmp = 1.0 + (((2.0 - x) - x) / y);
} else if (x <= -7.2e-38) {
tmp = x * 0.5;
} else if (x <= 4100000000000.0) {
tmp = y / (y + -2.0);
} else {
tmp = -1.0 - (y / (2.0 - (x + y)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-7d+18)) then
tmp = (y - x) / x
else if (x <= (-3.1d-25)) then
tmp = 1.0d0 + (((2.0d0 - x) - x) / y)
else if (x <= (-7.2d-38)) then
tmp = x * 0.5d0
else if (x <= 4100000000000.0d0) then
tmp = y / (y + (-2.0d0))
else
tmp = (-1.0d0) - (y / (2.0d0 - (x + y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -7e+18) {
tmp = (y - x) / x;
} else if (x <= -3.1e-25) {
tmp = 1.0 + (((2.0 - x) - x) / y);
} else if (x <= -7.2e-38) {
tmp = x * 0.5;
} else if (x <= 4100000000000.0) {
tmp = y / (y + -2.0);
} else {
tmp = -1.0 - (y / (2.0 - (x + y)));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -7e+18: tmp = (y - x) / x elif x <= -3.1e-25: tmp = 1.0 + (((2.0 - x) - x) / y) elif x <= -7.2e-38: tmp = x * 0.5 elif x <= 4100000000000.0: tmp = y / (y + -2.0) else: tmp = -1.0 - (y / (2.0 - (x + y))) return tmp
function code(x, y) tmp = 0.0 if (x <= -7e+18) tmp = Float64(Float64(y - x) / x); elseif (x <= -3.1e-25) tmp = Float64(1.0 + Float64(Float64(Float64(2.0 - x) - x) / y)); elseif (x <= -7.2e-38) tmp = Float64(x * 0.5); elseif (x <= 4100000000000.0) tmp = Float64(y / Float64(y + -2.0)); else tmp = Float64(-1.0 - Float64(y / Float64(2.0 - Float64(x + y)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -7e+18) tmp = (y - x) / x; elseif (x <= -3.1e-25) tmp = 1.0 + (((2.0 - x) - x) / y); elseif (x <= -7.2e-38) tmp = x * 0.5; elseif (x <= 4100000000000.0) tmp = y / (y + -2.0); else tmp = -1.0 - (y / (2.0 - (x + y))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -7e+18], N[(N[(y - x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, -3.1e-25], N[(1.0 + N[(N[(N[(2.0 - x), $MachinePrecision] - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -7.2e-38], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, 4100000000000.0], N[(y / N[(y + -2.0), $MachinePrecision]), $MachinePrecision], N[(-1.0 - N[(y / N[(2.0 - N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{+18}:\\
\;\;\;\;\frac{y - x}{x}\\
\mathbf{elif}\;x \leq -3.1 \cdot 10^{-25}:\\
\;\;\;\;1 + \frac{\left(2 - x\right) - x}{y}\\
\mathbf{elif}\;x \leq -7.2 \cdot 10^{-38}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;x \leq 4100000000000:\\
\;\;\;\;\frac{y}{y + -2}\\
\mathbf{else}:\\
\;\;\;\;-1 - \frac{y}{2 - \left(x + y\right)}\\
\end{array}
\end{array}
if x < -7e18Initial program 99.9%
associate--r+99.9%
Simplified99.9%
clear-num99.9%
associate-/r/99.6%
associate--l-99.6%
Applied egg-rr99.6%
Taylor expanded in x around inf 79.7%
associate-*l/80.0%
sub-neg80.0%
distribute-lft-in80.0%
neg-mul-180.0%
neg-mul-180.0%
remove-double-neg80.0%
Applied egg-rr80.0%
if -7e18 < x < -3.09999999999999995e-25Initial program 99.8%
associate--r+99.8%
Simplified99.8%
Taylor expanded in y around inf 71.0%
associate--l+71.0%
associate-*r/71.0%
associate-*r/71.0%
div-sub71.0%
cancel-sign-sub-inv71.0%
metadata-eval71.0%
*-lft-identity71.0%
+-commutative71.0%
mul-1-neg71.0%
unsub-neg71.0%
Simplified71.0%
if -3.09999999999999995e-25 < x < -7.2000000000000001e-38Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -7.2000000000000001e-38 < x < 4.1e12Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around 0 84.8%
mul-1-neg84.8%
distribute-neg-frac84.8%
Simplified84.8%
frac-2neg84.8%
div-inv84.7%
remove-double-neg84.7%
sub-neg84.7%
distribute-neg-in84.7%
metadata-eval84.7%
remove-double-neg84.7%
Applied egg-rr84.7%
associate-*r/84.8%
*-rgt-identity84.8%
+-commutative84.8%
Simplified84.8%
if 4.1e12 < x Initial program 99.9%
associate--r+99.9%
Simplified99.9%
div-sub100.0%
associate--l-100.0%
associate--l-100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 80.8%
Final simplification82.3%
(FPCore (x y)
:precision binary64
(if (<= x -1.1e+19)
-1.0
(if (<= x -6.5e-190)
1.0
(if (<= x -2.3e-268)
(* y -0.5)
(if (<= x -4.5e-304)
1.0
(if (<= x 1.05e-207)
(* y -0.5)
(if (<= x 18000000000000.0) 1.0 -1.0)))))))
double code(double x, double y) {
double tmp;
if (x <= -1.1e+19) {
tmp = -1.0;
} else if (x <= -6.5e-190) {
tmp = 1.0;
} else if (x <= -2.3e-268) {
tmp = y * -0.5;
} else if (x <= -4.5e-304) {
tmp = 1.0;
} else if (x <= 1.05e-207) {
tmp = y * -0.5;
} else if (x <= 18000000000000.0) {
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 (x <= (-1.1d+19)) then
tmp = -1.0d0
else if (x <= (-6.5d-190)) then
tmp = 1.0d0
else if (x <= (-2.3d-268)) then
tmp = y * (-0.5d0)
else if (x <= (-4.5d-304)) then
tmp = 1.0d0
else if (x <= 1.05d-207) then
tmp = y * (-0.5d0)
else if (x <= 18000000000000.0d0) 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 (x <= -1.1e+19) {
tmp = -1.0;
} else if (x <= -6.5e-190) {
tmp = 1.0;
} else if (x <= -2.3e-268) {
tmp = y * -0.5;
} else if (x <= -4.5e-304) {
tmp = 1.0;
} else if (x <= 1.05e-207) {
tmp = y * -0.5;
} else if (x <= 18000000000000.0) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.1e+19: tmp = -1.0 elif x <= -6.5e-190: tmp = 1.0 elif x <= -2.3e-268: tmp = y * -0.5 elif x <= -4.5e-304: tmp = 1.0 elif x <= 1.05e-207: tmp = y * -0.5 elif x <= 18000000000000.0: tmp = 1.0 else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -1.1e+19) tmp = -1.0; elseif (x <= -6.5e-190) tmp = 1.0; elseif (x <= -2.3e-268) tmp = Float64(y * -0.5); elseif (x <= -4.5e-304) tmp = 1.0; elseif (x <= 1.05e-207) tmp = Float64(y * -0.5); elseif (x <= 18000000000000.0) tmp = 1.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.1e+19) tmp = -1.0; elseif (x <= -6.5e-190) tmp = 1.0; elseif (x <= -2.3e-268) tmp = y * -0.5; elseif (x <= -4.5e-304) tmp = 1.0; elseif (x <= 1.05e-207) tmp = y * -0.5; elseif (x <= 18000000000000.0) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.1e+19], -1.0, If[LessEqual[x, -6.5e-190], 1.0, If[LessEqual[x, -2.3e-268], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, -4.5e-304], 1.0, If[LessEqual[x, 1.05e-207], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 18000000000000.0], 1.0, -1.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{+19}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq -6.5 \cdot 10^{-190}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -2.3 \cdot 10^{-268}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq -4.5 \cdot 10^{-304}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{-207}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 18000000000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if x < -1.1e19 or 1.8e13 < x Initial program 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in x around inf 79.8%
if -1.1e19 < x < -6.4999999999999997e-190 or -2.3000000000000001e-268 < x < -4.4999999999999998e-304 or 1.05000000000000002e-207 < x < 1.8e13Initial program 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in y around inf 57.7%
if -6.4999999999999997e-190 < x < -2.3000000000000001e-268 or -4.4999999999999998e-304 < x < 1.05000000000000002e-207Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around 0 95.0%
mul-1-neg95.0%
distribute-neg-frac95.0%
Simplified95.0%
Taylor expanded in y around 0 63.9%
*-commutative63.9%
Simplified63.9%
Final simplification68.8%
(FPCore (x y)
:precision binary64
(if (<= x -1500000000.0)
(+ -1.0 (/ -2.0 x))
(if (<= x -7e-190)
1.0
(if (<= x -2.35e-266)
(* y -0.5)
(if (<= x -6e-304)
1.0
(if (<= x 6.2e-206)
(* y -0.5)
(if (<= x 55000000000000.0) 1.0 -1.0)))))))
double code(double x, double y) {
double tmp;
if (x <= -1500000000.0) {
tmp = -1.0 + (-2.0 / x);
} else if (x <= -7e-190) {
tmp = 1.0;
} else if (x <= -2.35e-266) {
tmp = y * -0.5;
} else if (x <= -6e-304) {
tmp = 1.0;
} else if (x <= 6.2e-206) {
tmp = y * -0.5;
} else if (x <= 55000000000000.0) {
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 (x <= (-1500000000.0d0)) then
tmp = (-1.0d0) + ((-2.0d0) / x)
else if (x <= (-7d-190)) then
tmp = 1.0d0
else if (x <= (-2.35d-266)) then
tmp = y * (-0.5d0)
else if (x <= (-6d-304)) then
tmp = 1.0d0
else if (x <= 6.2d-206) then
tmp = y * (-0.5d0)
else if (x <= 55000000000000.0d0) 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 (x <= -1500000000.0) {
tmp = -1.0 + (-2.0 / x);
} else if (x <= -7e-190) {
tmp = 1.0;
} else if (x <= -2.35e-266) {
tmp = y * -0.5;
} else if (x <= -6e-304) {
tmp = 1.0;
} else if (x <= 6.2e-206) {
tmp = y * -0.5;
} else if (x <= 55000000000000.0) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1500000000.0: tmp = -1.0 + (-2.0 / x) elif x <= -7e-190: tmp = 1.0 elif x <= -2.35e-266: tmp = y * -0.5 elif x <= -6e-304: tmp = 1.0 elif x <= 6.2e-206: tmp = y * -0.5 elif x <= 55000000000000.0: tmp = 1.0 else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -1500000000.0) tmp = Float64(-1.0 + Float64(-2.0 / x)); elseif (x <= -7e-190) tmp = 1.0; elseif (x <= -2.35e-266) tmp = Float64(y * -0.5); elseif (x <= -6e-304) tmp = 1.0; elseif (x <= 6.2e-206) tmp = Float64(y * -0.5); elseif (x <= 55000000000000.0) tmp = 1.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1500000000.0) tmp = -1.0 + (-2.0 / x); elseif (x <= -7e-190) tmp = 1.0; elseif (x <= -2.35e-266) tmp = y * -0.5; elseif (x <= -6e-304) tmp = 1.0; elseif (x <= 6.2e-206) tmp = y * -0.5; elseif (x <= 55000000000000.0) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1500000000.0], N[(-1.0 + N[(-2.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -7e-190], 1.0, If[LessEqual[x, -2.35e-266], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, -6e-304], 1.0, If[LessEqual[x, 6.2e-206], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 55000000000000.0], 1.0, -1.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1500000000:\\
\;\;\;\;-1 + \frac{-2}{x}\\
\mathbf{elif}\;x \leq -7 \cdot 10^{-190}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -2.35 \cdot 10^{-266}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq -6 \cdot 10^{-304}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{-206}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 55000000000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if x < -1.5e9Initial program 99.8%
associate--r+99.8%
Simplified99.8%
Taylor expanded in y around 0 77.3%
Taylor expanded in x around inf 77.3%
distribute-neg-in77.3%
metadata-eval77.3%
associate-*r/77.3%
metadata-eval77.3%
distribute-neg-frac77.3%
metadata-eval77.3%
Simplified77.3%
if -1.5e9 < x < -6.9999999999999999e-190 or -2.35000000000000014e-266 < x < -6.0000000000000002e-304 or 6.2000000000000005e-206 < x < 5.5e13Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around inf 58.0%
if -6.9999999999999999e-190 < x < -2.35000000000000014e-266 or -6.0000000000000002e-304 < x < 6.2000000000000005e-206Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around 0 95.0%
mul-1-neg95.0%
distribute-neg-frac95.0%
Simplified95.0%
Taylor expanded in y around 0 63.9%
*-commutative63.9%
Simplified63.9%
if 5.5e13 < x Initial program 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in x around inf 80.4%
Final simplification68.8%
(FPCore (x y)
:precision binary64
(if (<= x -245000000000.0)
(+ -1.0 (/ -2.0 x))
(if (<= x -4.8e-189)
(- 1.0 (/ 2.0 y))
(if (<= x -7.5e-264)
(* y -0.5)
(if (<= x -2.5e-304)
1.0
(if (<= x 2.8e-207)
(* y -0.5)
(if (<= x 64000000000000.0) 1.0 -1.0)))))))
double code(double x, double y) {
double tmp;
if (x <= -245000000000.0) {
tmp = -1.0 + (-2.0 / x);
} else if (x <= -4.8e-189) {
tmp = 1.0 - (2.0 / y);
} else if (x <= -7.5e-264) {
tmp = y * -0.5;
} else if (x <= -2.5e-304) {
tmp = 1.0;
} else if (x <= 2.8e-207) {
tmp = y * -0.5;
} else if (x <= 64000000000000.0) {
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 (x <= (-245000000000.0d0)) then
tmp = (-1.0d0) + ((-2.0d0) / x)
else if (x <= (-4.8d-189)) then
tmp = 1.0d0 - (2.0d0 / y)
else if (x <= (-7.5d-264)) then
tmp = y * (-0.5d0)
else if (x <= (-2.5d-304)) then
tmp = 1.0d0
else if (x <= 2.8d-207) then
tmp = y * (-0.5d0)
else if (x <= 64000000000000.0d0) 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 (x <= -245000000000.0) {
tmp = -1.0 + (-2.0 / x);
} else if (x <= -4.8e-189) {
tmp = 1.0 - (2.0 / y);
} else if (x <= -7.5e-264) {
tmp = y * -0.5;
} else if (x <= -2.5e-304) {
tmp = 1.0;
} else if (x <= 2.8e-207) {
tmp = y * -0.5;
} else if (x <= 64000000000000.0) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -245000000000.0: tmp = -1.0 + (-2.0 / x) elif x <= -4.8e-189: tmp = 1.0 - (2.0 / y) elif x <= -7.5e-264: tmp = y * -0.5 elif x <= -2.5e-304: tmp = 1.0 elif x <= 2.8e-207: tmp = y * -0.5 elif x <= 64000000000000.0: tmp = 1.0 else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -245000000000.0) tmp = Float64(-1.0 + Float64(-2.0 / x)); elseif (x <= -4.8e-189) tmp = Float64(1.0 - Float64(2.0 / y)); elseif (x <= -7.5e-264) tmp = Float64(y * -0.5); elseif (x <= -2.5e-304) tmp = 1.0; elseif (x <= 2.8e-207) tmp = Float64(y * -0.5); elseif (x <= 64000000000000.0) tmp = 1.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -245000000000.0) tmp = -1.0 + (-2.0 / x); elseif (x <= -4.8e-189) tmp = 1.0 - (2.0 / y); elseif (x <= -7.5e-264) tmp = y * -0.5; elseif (x <= -2.5e-304) tmp = 1.0; elseif (x <= 2.8e-207) tmp = y * -0.5; elseif (x <= 64000000000000.0) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -245000000000.0], N[(-1.0 + N[(-2.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.8e-189], N[(1.0 - N[(2.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -7.5e-264], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, -2.5e-304], 1.0, If[LessEqual[x, 2.8e-207], N[(y * -0.5), $MachinePrecision], If[LessEqual[x, 64000000000000.0], 1.0, -1.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -245000000000:\\
\;\;\;\;-1 + \frac{-2}{x}\\
\mathbf{elif}\;x \leq -4.8 \cdot 10^{-189}:\\
\;\;\;\;1 - \frac{2}{y}\\
\mathbf{elif}\;x \leq -7.5 \cdot 10^{-264}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq -2.5 \cdot 10^{-304}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-207}:\\
\;\;\;\;y \cdot -0.5\\
\mathbf{elif}\;x \leq 64000000000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if x < -2.45e11Initial program 99.8%
associate--r+99.8%
Simplified99.8%
Taylor expanded in y around 0 77.3%
Taylor expanded in x around inf 77.3%
distribute-neg-in77.3%
metadata-eval77.3%
associate-*r/77.3%
metadata-eval77.3%
distribute-neg-frac77.3%
metadata-eval77.3%
Simplified77.3%
if -2.45e11 < x < -4.7999999999999997e-189Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around 0 73.0%
mul-1-neg73.0%
distribute-neg-frac73.0%
Simplified73.0%
frac-2neg73.0%
div-inv72.9%
remove-double-neg72.9%
sub-neg72.9%
distribute-neg-in72.9%
metadata-eval72.9%
remove-double-neg72.9%
Applied egg-rr72.9%
associate-*r/73.0%
*-rgt-identity73.0%
+-commutative73.0%
Simplified73.0%
frac-2neg73.0%
+-commutative73.0%
distribute-neg-in73.0%
metadata-eval73.0%
add-sqr-sqrt30.1%
sqrt-unprod29.4%
sqr-neg29.4%
sqrt-unprod13.3%
add-sqr-sqrt18.5%
*-un-lft-identity18.5%
add-cube-cbrt18.1%
times-frac18.1%
cbrt-unprod18.1%
sqr-neg18.1%
cbrt-unprod18.1%
pow218.1%
Applied egg-rr54.8%
/-rgt-identity54.8%
associate-*r/55.0%
unpow255.0%
rem-3cbrt-lft55.8%
Simplified55.8%
Taylor expanded in y around inf 55.6%
associate-*r/55.6%
metadata-eval55.6%
Simplified55.6%
if -4.7999999999999997e-189 < x < -7.5000000000000001e-264 or -2.49999999999999983e-304 < x < 2.79999999999999993e-207Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around 0 95.0%
mul-1-neg95.0%
distribute-neg-frac95.0%
Simplified95.0%
Taylor expanded in y around 0 63.9%
*-commutative63.9%
Simplified63.9%
if -7.5000000000000001e-264 < x < -2.49999999999999983e-304 or 2.79999999999999993e-207 < x < 6.4e13Initial program 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in y around inf 60.7%
if 6.4e13 < x Initial program 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in x around inf 80.4%
Final simplification68.9%
(FPCore (x y)
:precision binary64
(if (<= x -4.1e+18)
(/ (- y x) x)
(if (<= x -2.7e-25)
(+ 1.0 (/ (- (- 2.0 x) x) y))
(if (<= x -6.5e-38)
(* x 0.5)
(if (<= x 65000000000000.0) (/ y (+ y -2.0)) (+ -1.0 (/ y x)))))))
double code(double x, double y) {
double tmp;
if (x <= -4.1e+18) {
tmp = (y - x) / x;
} else if (x <= -2.7e-25) {
tmp = 1.0 + (((2.0 - x) - x) / y);
} else if (x <= -6.5e-38) {
tmp = x * 0.5;
} else if (x <= 65000000000000.0) {
tmp = y / (y + -2.0);
} else {
tmp = -1.0 + (y / x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-4.1d+18)) then
tmp = (y - x) / x
else if (x <= (-2.7d-25)) then
tmp = 1.0d0 + (((2.0d0 - x) - x) / y)
else if (x <= (-6.5d-38)) then
tmp = x * 0.5d0
else if (x <= 65000000000000.0d0) then
tmp = y / (y + (-2.0d0))
else
tmp = (-1.0d0) + (y / x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -4.1e+18) {
tmp = (y - x) / x;
} else if (x <= -2.7e-25) {
tmp = 1.0 + (((2.0 - x) - x) / y);
} else if (x <= -6.5e-38) {
tmp = x * 0.5;
} else if (x <= 65000000000000.0) {
tmp = y / (y + -2.0);
} else {
tmp = -1.0 + (y / x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -4.1e+18: tmp = (y - x) / x elif x <= -2.7e-25: tmp = 1.0 + (((2.0 - x) - x) / y) elif x <= -6.5e-38: tmp = x * 0.5 elif x <= 65000000000000.0: tmp = y / (y + -2.0) else: tmp = -1.0 + (y / x) return tmp
function code(x, y) tmp = 0.0 if (x <= -4.1e+18) tmp = Float64(Float64(y - x) / x); elseif (x <= -2.7e-25) tmp = Float64(1.0 + Float64(Float64(Float64(2.0 - x) - x) / y)); elseif (x <= -6.5e-38) tmp = Float64(x * 0.5); elseif (x <= 65000000000000.0) tmp = Float64(y / Float64(y + -2.0)); else tmp = Float64(-1.0 + Float64(y / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -4.1e+18) tmp = (y - x) / x; elseif (x <= -2.7e-25) tmp = 1.0 + (((2.0 - x) - x) / y); elseif (x <= -6.5e-38) tmp = x * 0.5; elseif (x <= 65000000000000.0) tmp = y / (y + -2.0); else tmp = -1.0 + (y / x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -4.1e+18], N[(N[(y - x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, -2.7e-25], N[(1.0 + N[(N[(N[(2.0 - x), $MachinePrecision] - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6.5e-38], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, 65000000000000.0], N[(y / N[(y + -2.0), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.1 \cdot 10^{+18}:\\
\;\;\;\;\frac{y - x}{x}\\
\mathbf{elif}\;x \leq -2.7 \cdot 10^{-25}:\\
\;\;\;\;1 + \frac{\left(2 - x\right) - x}{y}\\
\mathbf{elif}\;x \leq -6.5 \cdot 10^{-38}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;x \leq 65000000000000:\\
\;\;\;\;\frac{y}{y + -2}\\
\mathbf{else}:\\
\;\;\;\;-1 + \frac{y}{x}\\
\end{array}
\end{array}
if x < -4.1e18Initial program 99.9%
associate--r+99.9%
Simplified99.9%
clear-num99.9%
associate-/r/99.6%
associate--l-99.6%
Applied egg-rr99.6%
Taylor expanded in x around inf 79.7%
associate-*l/80.0%
sub-neg80.0%
distribute-lft-in80.0%
neg-mul-180.0%
neg-mul-180.0%
remove-double-neg80.0%
Applied egg-rr80.0%
if -4.1e18 < x < -2.70000000000000016e-25Initial program 99.8%
associate--r+99.8%
Simplified99.8%
Taylor expanded in y around inf 71.0%
associate--l+71.0%
associate-*r/71.0%
associate-*r/71.0%
div-sub71.0%
cancel-sign-sub-inv71.0%
metadata-eval71.0%
*-lft-identity71.0%
+-commutative71.0%
mul-1-neg71.0%
unsub-neg71.0%
Simplified71.0%
if -2.70000000000000016e-25 < x < -6.49999999999999949e-38Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -6.49999999999999949e-38 < x < 6.5e13Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around 0 84.8%
mul-1-neg84.8%
distribute-neg-frac84.8%
Simplified84.8%
frac-2neg84.8%
div-inv84.7%
remove-double-neg84.7%
sub-neg84.7%
distribute-neg-in84.7%
metadata-eval84.7%
remove-double-neg84.7%
Applied egg-rr84.7%
associate-*r/84.8%
*-rgt-identity84.8%
+-commutative84.8%
Simplified84.8%
if 6.5e13 < x Initial program 99.9%
associate--r+99.9%
Simplified99.9%
clear-num99.9%
associate-/r/99.7%
associate--l-99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 80.6%
Taylor expanded in x around 0 80.8%
Final simplification82.3%
(FPCore (x y) :precision binary64 (if (or (<= x -2.55e+17) (not (<= x 1.1e+16))) (+ -1.0 (/ y x)) (/ y (+ y -2.0))))
double code(double x, double y) {
double tmp;
if ((x <= -2.55e+17) || !(x <= 1.1e+16)) {
tmp = -1.0 + (y / x);
} else {
tmp = y / (y + -2.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-2.55d+17)) .or. (.not. (x <= 1.1d+16))) then
tmp = (-1.0d0) + (y / x)
else
tmp = y / (y + (-2.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -2.55e+17) || !(x <= 1.1e+16)) {
tmp = -1.0 + (y / x);
} else {
tmp = y / (y + -2.0);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -2.55e+17) or not (x <= 1.1e+16): tmp = -1.0 + (y / x) else: tmp = y / (y + -2.0) return tmp
function code(x, y) tmp = 0.0 if ((x <= -2.55e+17) || !(x <= 1.1e+16)) tmp = Float64(-1.0 + Float64(y / x)); else tmp = Float64(y / Float64(y + -2.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -2.55e+17) || ~((x <= 1.1e+16))) tmp = -1.0 + (y / x); else tmp = y / (y + -2.0); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -2.55e+17], N[Not[LessEqual[x, 1.1e+16]], $MachinePrecision]], N[(-1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision], N[(y / N[(y + -2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.55 \cdot 10^{+17} \lor \neg \left(x \leq 1.1 \cdot 10^{+16}\right):\\
\;\;\;\;-1 + \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{y + -2}\\
\end{array}
\end{array}
if x < -2.55e17 or 1.1e16 < x Initial program 99.9%
associate--r+99.9%
Simplified99.9%
clear-num99.9%
associate-/r/99.7%
associate--l-99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 80.1%
Taylor expanded in x around 0 80.4%
if -2.55e17 < x < 1.1e16Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around 0 81.0%
mul-1-neg81.0%
distribute-neg-frac81.0%
Simplified81.0%
frac-2neg81.0%
div-inv80.9%
remove-double-neg80.9%
sub-neg80.9%
distribute-neg-in80.9%
metadata-eval80.9%
remove-double-neg80.9%
Applied egg-rr80.9%
associate-*r/81.0%
*-rgt-identity81.0%
+-commutative81.0%
Simplified81.0%
Final simplification80.7%
(FPCore (x y) :precision binary64 (if (<= x -3e+18) (/ (- y x) x) (if (<= x 8500000000000.0) (/ y (+ y -2.0)) (+ -1.0 (/ y x)))))
double code(double x, double y) {
double tmp;
if (x <= -3e+18) {
tmp = (y - x) / x;
} else if (x <= 8500000000000.0) {
tmp = y / (y + -2.0);
} else {
tmp = -1.0 + (y / x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-3d+18)) then
tmp = (y - x) / x
else if (x <= 8500000000000.0d0) then
tmp = y / (y + (-2.0d0))
else
tmp = (-1.0d0) + (y / x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -3e+18) {
tmp = (y - x) / x;
} else if (x <= 8500000000000.0) {
tmp = y / (y + -2.0);
} else {
tmp = -1.0 + (y / x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -3e+18: tmp = (y - x) / x elif x <= 8500000000000.0: tmp = y / (y + -2.0) else: tmp = -1.0 + (y / x) return tmp
function code(x, y) tmp = 0.0 if (x <= -3e+18) tmp = Float64(Float64(y - x) / x); elseif (x <= 8500000000000.0) tmp = Float64(y / Float64(y + -2.0)); else tmp = Float64(-1.0 + Float64(y / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -3e+18) tmp = (y - x) / x; elseif (x <= 8500000000000.0) tmp = y / (y + -2.0); else tmp = -1.0 + (y / x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -3e+18], N[(N[(y - x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 8500000000000.0], N[(y / N[(y + -2.0), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{+18}:\\
\;\;\;\;\frac{y - x}{x}\\
\mathbf{elif}\;x \leq 8500000000000:\\
\;\;\;\;\frac{y}{y + -2}\\
\mathbf{else}:\\
\;\;\;\;-1 + \frac{y}{x}\\
\end{array}
\end{array}
if x < -3e18Initial program 99.9%
associate--r+99.9%
Simplified99.9%
clear-num99.9%
associate-/r/99.6%
associate--l-99.6%
Applied egg-rr99.6%
Taylor expanded in x around inf 79.7%
associate-*l/80.0%
sub-neg80.0%
distribute-lft-in80.0%
neg-mul-180.0%
neg-mul-180.0%
remove-double-neg80.0%
Applied egg-rr80.0%
if -3e18 < x < 8.5e12Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in x around 0 81.0%
mul-1-neg81.0%
distribute-neg-frac81.0%
Simplified81.0%
frac-2neg81.0%
div-inv80.9%
remove-double-neg80.9%
sub-neg80.9%
distribute-neg-in80.9%
metadata-eval80.9%
remove-double-neg80.9%
Applied egg-rr80.9%
associate-*r/81.0%
*-rgt-identity81.0%
+-commutative81.0%
Simplified81.0%
if 8.5e12 < x Initial program 99.9%
associate--r+99.9%
Simplified99.9%
clear-num99.9%
associate-/r/99.7%
associate--l-99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 80.6%
Taylor expanded in x around 0 80.8%
Final simplification80.7%
(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 99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (<= x -1.6e+18) -1.0 (if (<= x 980000000000.0) 1.0 -1.0)))
double code(double x, double y) {
double tmp;
if (x <= -1.6e+18) {
tmp = -1.0;
} else if (x <= 980000000000.0) {
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 (x <= (-1.6d+18)) then
tmp = -1.0d0
else if (x <= 980000000000.0d0) 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 (x <= -1.6e+18) {
tmp = -1.0;
} else if (x <= 980000000000.0) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.6e+18: tmp = -1.0 elif x <= 980000000000.0: tmp = 1.0 else: tmp = -1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -1.6e+18) tmp = -1.0; elseif (x <= 980000000000.0) tmp = 1.0; else tmp = -1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.6e+18) tmp = -1.0; elseif (x <= 980000000000.0) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.6e+18], -1.0, If[LessEqual[x, 980000000000.0], 1.0, -1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{+18}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq 980000000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if x < -1.6e18 or 9.8e11 < x Initial program 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in x around inf 79.8%
if -1.6e18 < x < 9.8e11Initial program 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in y around inf 50.2%
Final simplification63.8%
(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 99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in x around inf 39.1%
Final simplification39.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 2023266
(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))))