
(FPCore (x y) :precision binary64 (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))
double code(double x, double y) {
return 1.0 - (((1.0 - x) * y) / (y + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 - (((1.0d0 - x) * y) / (y + 1.0d0))
end function
public static double code(double x, double y) {
return 1.0 - (((1.0 - x) * y) / (y + 1.0));
}
def code(x, y): return 1.0 - (((1.0 - x) * y) / (y + 1.0))
function code(x, y) return Float64(1.0 - Float64(Float64(Float64(1.0 - x) * y) / Float64(y + 1.0))) end
function tmp = code(x, y) tmp = 1.0 - (((1.0 - x) * y) / (y + 1.0)); end
code[x_, y_] := N[(1.0 - N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{\left(1 - x\right) \cdot y}{y + 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))
double code(double x, double y) {
return 1.0 - (((1.0 - x) * y) / (y + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 - (((1.0d0 - x) * y) / (y + 1.0d0))
end function
public static double code(double x, double y) {
return 1.0 - (((1.0 - x) * y) / (y + 1.0));
}
def code(x, y): return 1.0 - (((1.0 - x) * y) / (y + 1.0))
function code(x, y) return Float64(1.0 - Float64(Float64(Float64(1.0 - x) * y) / Float64(y + 1.0))) end
function tmp = code(x, y) tmp = 1.0 - (((1.0 - x) * y) / (y + 1.0)); end
code[x_, y_] := N[(1.0 - N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{\left(1 - x\right) \cdot y}{y + 1}
\end{array}
(FPCore (x y)
:precision binary64
(let* ((t_0 (pow (+ y 1.0) 2.0))
(t_1 (/ (pow y 2.0) t_0))
(t_2 (/ y (+ y 1.0)))
(t_3 (+ 1.0 (+ t_1 t_2)))
(t_4 (pow (+ y 1.0) 3.0))
(t_5 (+ -1.0 (- (/ y (- -1.0 y)) t_1))))
(if (or (<= y -19500.0) (not (<= y 20000.0)))
(+
x
(-
(/ (- 1.0 x) (pow y 3.0))
(- (/ (+ x -1.0) y) (/ (+ x -1.0) (pow y 2.0)))))
(+
(fma
x
(fma
3.0
(/ (pow y 3.0) (* t_4 t_3))
(/
(* (- 1.0 (/ (pow y 3.0) t_4)) (- t_2 (/ (* (pow y 2.0) -2.0) t_0)))
(pow t_3 2.0)))
(/ -1.0 t_5))
(/ (pow y 3.0) (* t_4 t_5))))))
double code(double x, double y) {
double t_0 = pow((y + 1.0), 2.0);
double t_1 = pow(y, 2.0) / t_0;
double t_2 = y / (y + 1.0);
double t_3 = 1.0 + (t_1 + t_2);
double t_4 = pow((y + 1.0), 3.0);
double t_5 = -1.0 + ((y / (-1.0 - y)) - t_1);
double tmp;
if ((y <= -19500.0) || !(y <= 20000.0)) {
tmp = x + (((1.0 - x) / pow(y, 3.0)) - (((x + -1.0) / y) - ((x + -1.0) / pow(y, 2.0))));
} else {
tmp = fma(x, fma(3.0, (pow(y, 3.0) / (t_4 * t_3)), (((1.0 - (pow(y, 3.0) / t_4)) * (t_2 - ((pow(y, 2.0) * -2.0) / t_0))) / pow(t_3, 2.0))), (-1.0 / t_5)) + (pow(y, 3.0) / (t_4 * t_5));
}
return tmp;
}
function code(x, y) t_0 = Float64(y + 1.0) ^ 2.0 t_1 = Float64((y ^ 2.0) / t_0) t_2 = Float64(y / Float64(y + 1.0)) t_3 = Float64(1.0 + Float64(t_1 + t_2)) t_4 = Float64(y + 1.0) ^ 3.0 t_5 = Float64(-1.0 + Float64(Float64(y / Float64(-1.0 - y)) - t_1)) tmp = 0.0 if ((y <= -19500.0) || !(y <= 20000.0)) tmp = Float64(x + Float64(Float64(Float64(1.0 - x) / (y ^ 3.0)) - Float64(Float64(Float64(x + -1.0) / y) - Float64(Float64(x + -1.0) / (y ^ 2.0))))); else tmp = Float64(fma(x, fma(3.0, Float64((y ^ 3.0) / Float64(t_4 * t_3)), Float64(Float64(Float64(1.0 - Float64((y ^ 3.0) / t_4)) * Float64(t_2 - Float64(Float64((y ^ 2.0) * -2.0) / t_0))) / (t_3 ^ 2.0))), Float64(-1.0 / t_5)) + Float64((y ^ 3.0) / Float64(t_4 * t_5))); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[Power[N[(y + 1.0), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[y, 2.0], $MachinePrecision] / t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 + N[(t$95$1 + t$95$2), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Power[N[(y + 1.0), $MachinePrecision], 3.0], $MachinePrecision]}, Block[{t$95$5 = N[(-1.0 + N[(N[(y / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[y, -19500.0], N[Not[LessEqual[y, 20000.0]], $MachinePrecision]], N[(x + N[(N[(N[(1.0 - x), $MachinePrecision] / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x + -1.0), $MachinePrecision] / N[Power[y, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(3.0 * N[(N[Power[y, 3.0], $MachinePrecision] / N[(t$95$4 * t$95$3), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 - N[(N[Power[y, 3.0], $MachinePrecision] / t$95$4), $MachinePrecision]), $MachinePrecision] * N[(t$95$2 - N[(N[(N[Power[y, 2.0], $MachinePrecision] * -2.0), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[t$95$3, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / t$95$5), $MachinePrecision]), $MachinePrecision] + N[(N[Power[y, 3.0], $MachinePrecision] / N[(t$95$4 * t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(y + 1\right)}^{2}\\
t_1 := \frac{{y}^{2}}{t\_0}\\
t_2 := \frac{y}{y + 1}\\
t_3 := 1 + \left(t\_1 + t\_2\right)\\
t_4 := {\left(y + 1\right)}^{3}\\
t_5 := -1 + \left(\frac{y}{-1 - y} - t\_1\right)\\
\mathbf{if}\;y \leq -19500 \lor \neg \left(y \leq 20000\right):\\
\;\;\;\;x + \left(\frac{1 - x}{{y}^{3}} - \left(\frac{x + -1}{y} - \frac{x + -1}{{y}^{2}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(3, \frac{{y}^{3}}{t\_4 \cdot t\_3}, \frac{\left(1 - \frac{{y}^{3}}{t\_4}\right) \cdot \left(t\_2 - \frac{{y}^{2} \cdot -2}{t\_0}\right)}{{t\_3}^{2}}\right), \frac{-1}{t\_5}\right) + \frac{{y}^{3}}{t\_4 \cdot t\_5}\\
\end{array}
\end{array}
if y < -19500 or 2e4 < y Initial program 30.6%
associate-/l*51.8%
remove-double-neg51.8%
remove-double-neg51.8%
+-commutative51.8%
Simplified51.8%
Taylor expanded in y around -inf 99.9%
associate--l+99.9%
associate-+r+99.9%
associate--l+99.9%
div-sub99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
metadata-eval99.9%
associate--r-99.9%
neg-sub099.9%
distribute-frac-neg99.9%
mul-1-neg99.9%
+-commutative99.9%
Simplified99.9%
if -19500 < y < 2e4Initial program 99.8%
associate-/l*99.8%
remove-double-neg99.8%
remove-double-neg99.8%
+-commutative99.8%
Simplified99.8%
sub-neg99.8%
+-commutative99.8%
associate-*r/99.8%
distribute-neg-frac299.8%
distribute-neg-in99.8%
metadata-eval99.8%
sub-neg99.8%
*-commutative99.8%
associate-*r/99.8%
flip3-+93.1%
metadata-eval93.1%
metadata-eval93.1%
Applied egg-rr93.1%
Taylor expanded in x around 0 99.8%
Simplified99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(if (or (<= y -19500.0) (not (<= y 14000.0)))
(+
x
(-
(/ (- 1.0 x) (pow y 3.0))
(- (/ (+ x -1.0) y) (/ (+ x -1.0) (pow y 2.0)))))
(fma y (/ (- 1.0 x) (- -1.0 y)) 1.0)))
double code(double x, double y) {
double tmp;
if ((y <= -19500.0) || !(y <= 14000.0)) {
tmp = x + (((1.0 - x) / pow(y, 3.0)) - (((x + -1.0) / y) - ((x + -1.0) / pow(y, 2.0))));
} else {
tmp = fma(y, ((1.0 - x) / (-1.0 - y)), 1.0);
}
return tmp;
}
function code(x, y) tmp = 0.0 if ((y <= -19500.0) || !(y <= 14000.0)) tmp = Float64(x + Float64(Float64(Float64(1.0 - x) / (y ^ 3.0)) - Float64(Float64(Float64(x + -1.0) / y) - Float64(Float64(x + -1.0) / (y ^ 2.0))))); else tmp = fma(y, Float64(Float64(1.0 - x) / Float64(-1.0 - y)), 1.0); end return tmp end
code[x_, y_] := If[Or[LessEqual[y, -19500.0], N[Not[LessEqual[y, 14000.0]], $MachinePrecision]], N[(x + N[(N[(N[(1.0 - x), $MachinePrecision] / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x + -1.0), $MachinePrecision] / N[Power[y, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(1.0 - x), $MachinePrecision] / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -19500 \lor \neg \left(y \leq 14000\right):\\
\;\;\;\;x + \left(\frac{1 - x}{{y}^{3}} - \left(\frac{x + -1}{y} - \frac{x + -1}{{y}^{2}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{1 - x}{-1 - y}, 1\right)\\
\end{array}
\end{array}
if y < -19500 or 14000 < y Initial program 30.6%
associate-/l*51.8%
remove-double-neg51.8%
remove-double-neg51.8%
+-commutative51.8%
Simplified51.8%
Taylor expanded in y around -inf 99.9%
associate--l+99.9%
associate-+r+99.9%
associate--l+99.9%
div-sub99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
metadata-eval99.9%
associate--r-99.9%
neg-sub099.9%
distribute-frac-neg99.9%
mul-1-neg99.9%
+-commutative99.9%
Simplified99.9%
if -19500 < y < 14000Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
*-commutative99.8%
associate-/l*99.8%
distribute-rgt-neg-in99.8%
fma-define99.8%
distribute-frac-neg299.8%
+-commutative99.8%
distribute-neg-in99.8%
metadata-eval99.8%
unsub-neg99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (or (<= y -280000.0) (not (<= y 250000.0))) (+ x (+ (/ (+ x -1.0) (pow y 2.0)) (/ (- 1.0 x) y))) (fma y (/ (- 1.0 x) (- -1.0 y)) 1.0)))
double code(double x, double y) {
double tmp;
if ((y <= -280000.0) || !(y <= 250000.0)) {
tmp = x + (((x + -1.0) / pow(y, 2.0)) + ((1.0 - x) / y));
} else {
tmp = fma(y, ((1.0 - x) / (-1.0 - y)), 1.0);
}
return tmp;
}
function code(x, y) tmp = 0.0 if ((y <= -280000.0) || !(y <= 250000.0)) tmp = Float64(x + Float64(Float64(Float64(x + -1.0) / (y ^ 2.0)) + Float64(Float64(1.0 - x) / y))); else tmp = fma(y, Float64(Float64(1.0 - x) / Float64(-1.0 - y)), 1.0); end return tmp end
code[x_, y_] := If[Or[LessEqual[y, -280000.0], N[Not[LessEqual[y, 250000.0]], $MachinePrecision]], N[(x + N[(N[(N[(x + -1.0), $MachinePrecision] / N[Power[y, 2.0], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(1.0 - x), $MachinePrecision] / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -280000 \lor \neg \left(y \leq 250000\right):\\
\;\;\;\;x + \left(\frac{x + -1}{{y}^{2}} + \frac{1 - x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{1 - x}{-1 - y}, 1\right)\\
\end{array}
\end{array}
if y < -2.8e5 or 2.5e5 < y Initial program 30.3%
associate-/l*51.6%
remove-double-neg51.6%
remove-double-neg51.6%
+-commutative51.6%
Simplified51.6%
Taylor expanded in y around inf 99.9%
associate--l+99.9%
neg-mul-199.9%
sub-neg99.9%
associate--l+99.9%
div-sub99.9%
sub-neg99.9%
+-commutative99.9%
neg-mul-199.9%
metadata-eval99.9%
distribute-lft-in99.9%
metadata-eval99.9%
sub-neg99.9%
associate-*r/99.9%
mul-1-neg99.9%
unsub-neg99.9%
Simplified99.9%
if -2.8e5 < y < 2.5e5Initial program 99.6%
sub-neg99.6%
+-commutative99.6%
*-commutative99.6%
associate-/l*99.6%
distribute-rgt-neg-in99.6%
fma-define99.6%
distribute-frac-neg299.6%
+-commutative99.6%
distribute-neg-in99.6%
metadata-eval99.6%
unsub-neg99.6%
Simplified99.6%
Final simplification99.8%
(FPCore (x y)
:precision binary64
(if (<= y -6e+60)
x
(if (<= y -1.0)
(/ 1.0 y)
(if (<= y 5e-16)
(- 1.0 y)
(if (<= y 2.9e+105) x (if (<= y 2.6e+139) (/ 1.0 y) x))))))
double code(double x, double y) {
double tmp;
if (y <= -6e+60) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= 5e-16) {
tmp = 1.0 - y;
} else if (y <= 2.9e+105) {
tmp = x;
} else if (y <= 2.6e+139) {
tmp = 1.0 / y;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-6d+60)) then
tmp = x
else if (y <= (-1.0d0)) then
tmp = 1.0d0 / y
else if (y <= 5d-16) then
tmp = 1.0d0 - y
else if (y <= 2.9d+105) then
tmp = x
else if (y <= 2.6d+139) then
tmp = 1.0d0 / y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -6e+60) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= 5e-16) {
tmp = 1.0 - y;
} else if (y <= 2.9e+105) {
tmp = x;
} else if (y <= 2.6e+139) {
tmp = 1.0 / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -6e+60: tmp = x elif y <= -1.0: tmp = 1.0 / y elif y <= 5e-16: tmp = 1.0 - y elif y <= 2.9e+105: tmp = x elif y <= 2.6e+139: tmp = 1.0 / y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -6e+60) tmp = x; elseif (y <= -1.0) tmp = Float64(1.0 / y); elseif (y <= 5e-16) tmp = Float64(1.0 - y); elseif (y <= 2.9e+105) tmp = x; elseif (y <= 2.6e+139) tmp = Float64(1.0 / y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -6e+60) tmp = x; elseif (y <= -1.0) tmp = 1.0 / y; elseif (y <= 5e-16) tmp = 1.0 - y; elseif (y <= 2.9e+105) tmp = x; elseif (y <= 2.6e+139) tmp = 1.0 / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -6e+60], x, If[LessEqual[y, -1.0], N[(1.0 / y), $MachinePrecision], If[LessEqual[y, 5e-16], N[(1.0 - y), $MachinePrecision], If[LessEqual[y, 2.9e+105], x, If[LessEqual[y, 2.6e+139], N[(1.0 / y), $MachinePrecision], x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{+60}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-16}:\\
\;\;\;\;1 - y\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{+105}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+139}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -5.9999999999999997e60 or 5.0000000000000004e-16 < y < 2.9000000000000001e105 or 2.60000000000000022e139 < y Initial program 35.0%
associate-/l*59.4%
remove-double-neg59.4%
remove-double-neg59.4%
+-commutative59.4%
Simplified59.4%
Taylor expanded in y around inf 76.6%
if -5.9999999999999997e60 < y < -1 or 2.9000000000000001e105 < y < 2.60000000000000022e139Initial program 29.6%
sub-neg29.6%
+-commutative29.6%
*-commutative29.6%
associate-/l*32.8%
distribute-rgt-neg-in32.8%
fma-define34.0%
distribute-frac-neg234.0%
+-commutative34.0%
distribute-neg-in34.0%
metadata-eval34.0%
unsub-neg34.0%
Simplified34.0%
Taylor expanded in x around 0 17.5%
metadata-eval17.5%
distribute-neg-frac17.5%
distribute-neg-frac217.5%
distribute-neg-in17.5%
metadata-eval17.5%
sub-neg17.5%
Simplified17.5%
Taylor expanded in y around inf 76.1%
Taylor expanded in y around inf 72.4%
if -1 < y < 5.0000000000000004e-16Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-rgt-neg-in100.0%
fma-define100.0%
distribute-frac-neg2100.0%
+-commutative100.0%
distribute-neg-in100.0%
metadata-eval100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 83.9%
metadata-eval83.9%
distribute-neg-frac83.9%
distribute-neg-frac283.9%
distribute-neg-in83.9%
metadata-eval83.9%
sub-neg83.9%
Simplified83.9%
Taylor expanded in y around 0 83.3%
neg-mul-183.3%
unsub-neg83.3%
Simplified83.3%
Final simplification79.1%
(FPCore (x y)
:precision binary64
(if (<= y -2.65e+59)
x
(if (<= y -1.0)
(/ 1.0 y)
(if (<= y 1.0)
(- 1.0 y)
(if (<= y 4.4e+102) (- x (/ x y)) (if (<= y 2.6e+139) (/ 1.0 y) x))))))
double code(double x, double y) {
double tmp;
if (y <= -2.65e+59) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= 1.0) {
tmp = 1.0 - y;
} else if (y <= 4.4e+102) {
tmp = x - (x / y);
} else if (y <= 2.6e+139) {
tmp = 1.0 / y;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-2.65d+59)) then
tmp = x
else if (y <= (-1.0d0)) then
tmp = 1.0d0 / y
else if (y <= 1.0d0) then
tmp = 1.0d0 - y
else if (y <= 4.4d+102) then
tmp = x - (x / y)
else if (y <= 2.6d+139) then
tmp = 1.0d0 / y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -2.65e+59) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= 1.0) {
tmp = 1.0 - y;
} else if (y <= 4.4e+102) {
tmp = x - (x / y);
} else if (y <= 2.6e+139) {
tmp = 1.0 / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.65e+59: tmp = x elif y <= -1.0: tmp = 1.0 / y elif y <= 1.0: tmp = 1.0 - y elif y <= 4.4e+102: tmp = x - (x / y) elif y <= 2.6e+139: tmp = 1.0 / y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -2.65e+59) tmp = x; elseif (y <= -1.0) tmp = Float64(1.0 / y); elseif (y <= 1.0) tmp = Float64(1.0 - y); elseif (y <= 4.4e+102) tmp = Float64(x - Float64(x / y)); elseif (y <= 2.6e+139) tmp = Float64(1.0 / y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2.65e+59) tmp = x; elseif (y <= -1.0) tmp = 1.0 / y; elseif (y <= 1.0) tmp = 1.0 - y; elseif (y <= 4.4e+102) tmp = x - (x / y); elseif (y <= 2.6e+139) tmp = 1.0 / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.65e+59], x, If[LessEqual[y, -1.0], N[(1.0 / y), $MachinePrecision], If[LessEqual[y, 1.0], N[(1.0 - y), $MachinePrecision], If[LessEqual[y, 4.4e+102], N[(x - N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.6e+139], N[(1.0 / y), $MachinePrecision], x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.65 \cdot 10^{+59}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;1 - y\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{+102}:\\
\;\;\;\;x - \frac{x}{y}\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+139}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.6499999999999998e59 or 2.60000000000000022e139 < y Initial program 26.1%
associate-/l*56.8%
remove-double-neg56.8%
remove-double-neg56.8%
+-commutative56.8%
Simplified56.8%
Taylor expanded in y around inf 84.5%
if -2.6499999999999998e59 < y < -1 or 4.40000000000000015e102 < y < 2.60000000000000022e139Initial program 29.6%
sub-neg29.6%
+-commutative29.6%
*-commutative29.6%
associate-/l*32.8%
distribute-rgt-neg-in32.8%
fma-define34.0%
distribute-frac-neg234.0%
+-commutative34.0%
distribute-neg-in34.0%
metadata-eval34.0%
unsub-neg34.0%
Simplified34.0%
Taylor expanded in x around 0 17.5%
metadata-eval17.5%
distribute-neg-frac17.5%
distribute-neg-frac217.5%
distribute-neg-in17.5%
metadata-eval17.5%
sub-neg17.5%
Simplified17.5%
Taylor expanded in y around inf 76.1%
Taylor expanded in y around inf 72.4%
if -1 < y < 1Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-rgt-neg-in100.0%
fma-define100.0%
distribute-frac-neg2100.0%
+-commutative100.0%
distribute-neg-in100.0%
metadata-eval100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 81.8%
metadata-eval81.8%
distribute-neg-frac81.8%
distribute-neg-frac281.8%
distribute-neg-in81.8%
metadata-eval81.8%
sub-neg81.8%
Simplified81.8%
Taylor expanded in y around 0 81.1%
neg-mul-181.1%
unsub-neg81.1%
Simplified81.1%
if 1 < y < 4.40000000000000015e102Initial program 56.6%
associate-/l*63.4%
remove-double-neg63.4%
remove-double-neg63.4%
+-commutative63.4%
Simplified63.4%
Taylor expanded in x around inf 57.1%
*-commutative57.1%
associate-/l*63.7%
Simplified63.7%
Taylor expanded in y around inf 62.5%
mul-1-neg62.5%
unsub-neg62.5%
Simplified62.5%
Final simplification79.4%
(FPCore (x y)
:precision binary64
(if (<= y -3.35e+62)
x
(if (<= y -1.0)
(/ 1.0 y)
(if (<= y 440.0)
(+ 1.0 (* y x))
(if (<= y 2e+104) (- x (/ x y)) (if (<= y 2.6e+139) (/ 1.0 y) x))))))
double code(double x, double y) {
double tmp;
if (y <= -3.35e+62) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= 440.0) {
tmp = 1.0 + (y * x);
} else if (y <= 2e+104) {
tmp = x - (x / y);
} else if (y <= 2.6e+139) {
tmp = 1.0 / y;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-3.35d+62)) then
tmp = x
else if (y <= (-1.0d0)) then
tmp = 1.0d0 / y
else if (y <= 440.0d0) then
tmp = 1.0d0 + (y * x)
else if (y <= 2d+104) then
tmp = x - (x / y)
else if (y <= 2.6d+139) then
tmp = 1.0d0 / y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -3.35e+62) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= 440.0) {
tmp = 1.0 + (y * x);
} else if (y <= 2e+104) {
tmp = x - (x / y);
} else if (y <= 2.6e+139) {
tmp = 1.0 / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.35e+62: tmp = x elif y <= -1.0: tmp = 1.0 / y elif y <= 440.0: tmp = 1.0 + (y * x) elif y <= 2e+104: tmp = x - (x / y) elif y <= 2.6e+139: tmp = 1.0 / y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -3.35e+62) tmp = x; elseif (y <= -1.0) tmp = Float64(1.0 / y); elseif (y <= 440.0) tmp = Float64(1.0 + Float64(y * x)); elseif (y <= 2e+104) tmp = Float64(x - Float64(x / y)); elseif (y <= 2.6e+139) tmp = Float64(1.0 / y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3.35e+62) tmp = x; elseif (y <= -1.0) tmp = 1.0 / y; elseif (y <= 440.0) tmp = 1.0 + (y * x); elseif (y <= 2e+104) tmp = x - (x / y); elseif (y <= 2.6e+139) tmp = 1.0 / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.35e+62], x, If[LessEqual[y, -1.0], N[(1.0 / y), $MachinePrecision], If[LessEqual[y, 440.0], N[(1.0 + N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2e+104], N[(x - N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.6e+139], N[(1.0 / y), $MachinePrecision], x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.35 \cdot 10^{+62}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{elif}\;y \leq 440:\\
\;\;\;\;1 + y \cdot x\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+104}:\\
\;\;\;\;x - \frac{x}{y}\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+139}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -3.3499999999999998e62 or 2.60000000000000022e139 < y Initial program 26.1%
associate-/l*56.8%
remove-double-neg56.8%
remove-double-neg56.8%
+-commutative56.8%
Simplified56.8%
Taylor expanded in y around inf 84.5%
if -3.3499999999999998e62 < y < -1 or 2e104 < y < 2.60000000000000022e139Initial program 29.6%
sub-neg29.6%
+-commutative29.6%
*-commutative29.6%
associate-/l*32.8%
distribute-rgt-neg-in32.8%
fma-define34.0%
distribute-frac-neg234.0%
+-commutative34.0%
distribute-neg-in34.0%
metadata-eval34.0%
unsub-neg34.0%
Simplified34.0%
Taylor expanded in x around 0 17.5%
metadata-eval17.5%
distribute-neg-frac17.5%
distribute-neg-frac217.5%
distribute-neg-in17.5%
metadata-eval17.5%
sub-neg17.5%
Simplified17.5%
Taylor expanded in y around inf 76.1%
Taylor expanded in y around inf 72.4%
if -1 < y < 440Initial program 99.9%
associate-/l*99.9%
remove-double-neg99.9%
remove-double-neg99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 97.4%
Taylor expanded in x around inf 97.2%
mul-1-neg97.2%
distribute-lft-neg-out97.2%
*-commutative97.2%
Simplified97.2%
if 440 < y < 2e104Initial program 55.3%
associate-/l*62.3%
remove-double-neg62.3%
remove-double-neg62.3%
+-commutative62.3%
Simplified62.3%
Taylor expanded in x around inf 59.3%
*-commutative59.3%
associate-/l*66.1%
Simplified66.1%
Taylor expanded in y around inf 64.9%
mul-1-neg64.9%
unsub-neg64.9%
Simplified64.9%
Final simplification87.0%
(FPCore (x y)
:precision binary64
(if (<= y -5.7e+60)
x
(if (<= y -1.0)
(/ 1.0 y)
(if (<= y 5e-16)
(+ 1.0 (* y x))
(if (<= y 1.3e+103)
(* y (/ x (+ y 1.0)))
(if (<= y 2.6e+139) (/ 1.0 y) x))))))
double code(double x, double y) {
double tmp;
if (y <= -5.7e+60) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= 5e-16) {
tmp = 1.0 + (y * x);
} else if (y <= 1.3e+103) {
tmp = y * (x / (y + 1.0));
} else if (y <= 2.6e+139) {
tmp = 1.0 / y;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-5.7d+60)) then
tmp = x
else if (y <= (-1.0d0)) then
tmp = 1.0d0 / y
else if (y <= 5d-16) then
tmp = 1.0d0 + (y * x)
else if (y <= 1.3d+103) then
tmp = y * (x / (y + 1.0d0))
else if (y <= 2.6d+139) then
tmp = 1.0d0 / y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -5.7e+60) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= 5e-16) {
tmp = 1.0 + (y * x);
} else if (y <= 1.3e+103) {
tmp = y * (x / (y + 1.0));
} else if (y <= 2.6e+139) {
tmp = 1.0 / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5.7e+60: tmp = x elif y <= -1.0: tmp = 1.0 / y elif y <= 5e-16: tmp = 1.0 + (y * x) elif y <= 1.3e+103: tmp = y * (x / (y + 1.0)) elif y <= 2.6e+139: tmp = 1.0 / y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -5.7e+60) tmp = x; elseif (y <= -1.0) tmp = Float64(1.0 / y); elseif (y <= 5e-16) tmp = Float64(1.0 + Float64(y * x)); elseif (y <= 1.3e+103) tmp = Float64(y * Float64(x / Float64(y + 1.0))); elseif (y <= 2.6e+139) tmp = Float64(1.0 / y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5.7e+60) tmp = x; elseif (y <= -1.0) tmp = 1.0 / y; elseif (y <= 5e-16) tmp = 1.0 + (y * x); elseif (y <= 1.3e+103) tmp = y * (x / (y + 1.0)); elseif (y <= 2.6e+139) tmp = 1.0 / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5.7e+60], x, If[LessEqual[y, -1.0], N[(1.0 / y), $MachinePrecision], If[LessEqual[y, 5e-16], N[(1.0 + N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.3e+103], N[(y * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.6e+139], N[(1.0 / y), $MachinePrecision], x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.7 \cdot 10^{+60}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-16}:\\
\;\;\;\;1 + y \cdot x\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{+103}:\\
\;\;\;\;y \cdot \frac{x}{y + 1}\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+139}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -5.69999999999999978e60 or 2.60000000000000022e139 < y Initial program 26.1%
associate-/l*56.8%
remove-double-neg56.8%
remove-double-neg56.8%
+-commutative56.8%
Simplified56.8%
Taylor expanded in y around inf 84.5%
if -5.69999999999999978e60 < y < -1 or 1.3000000000000001e103 < y < 2.60000000000000022e139Initial program 29.6%
sub-neg29.6%
+-commutative29.6%
*-commutative29.6%
associate-/l*32.8%
distribute-rgt-neg-in32.8%
fma-define34.0%
distribute-frac-neg234.0%
+-commutative34.0%
distribute-neg-in34.0%
metadata-eval34.0%
unsub-neg34.0%
Simplified34.0%
Taylor expanded in x around 0 17.5%
metadata-eval17.5%
distribute-neg-frac17.5%
distribute-neg-frac217.5%
distribute-neg-in17.5%
metadata-eval17.5%
sub-neg17.5%
Simplified17.5%
Taylor expanded in y around inf 76.1%
Taylor expanded in y around inf 72.4%
if -1 < y < 5.0000000000000004e-16Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 99.4%
Taylor expanded in x around inf 99.0%
mul-1-neg99.0%
distribute-lft-neg-out99.0%
*-commutative99.0%
Simplified99.0%
if 5.0000000000000004e-16 < y < 1.3000000000000001e103Initial program 61.0%
associate-/l*67.0%
remove-double-neg67.0%
remove-double-neg67.0%
+-commutative67.0%
Simplified67.0%
Taylor expanded in x around inf 61.4%
*-commutative61.4%
associate-/l*67.4%
Simplified67.4%
Final simplification87.6%
(FPCore (x y)
:precision binary64
(if (<= y -7.5e+58)
x
(if (<= y -1.0)
(/ 1.0 y)
(if (<= y 5e-16)
(+ 1.0 (* y (+ x -1.0)))
(if (<= y 3e+105)
(* y (/ x (+ y 1.0)))
(if (<= y 2.6e+139) (/ 1.0 y) x))))))
double code(double x, double y) {
double tmp;
if (y <= -7.5e+58) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= 5e-16) {
tmp = 1.0 + (y * (x + -1.0));
} else if (y <= 3e+105) {
tmp = y * (x / (y + 1.0));
} else if (y <= 2.6e+139) {
tmp = 1.0 / y;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-7.5d+58)) then
tmp = x
else if (y <= (-1.0d0)) then
tmp = 1.0d0 / y
else if (y <= 5d-16) then
tmp = 1.0d0 + (y * (x + (-1.0d0)))
else if (y <= 3d+105) then
tmp = y * (x / (y + 1.0d0))
else if (y <= 2.6d+139) then
tmp = 1.0d0 / y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -7.5e+58) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= 5e-16) {
tmp = 1.0 + (y * (x + -1.0));
} else if (y <= 3e+105) {
tmp = y * (x / (y + 1.0));
} else if (y <= 2.6e+139) {
tmp = 1.0 / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7.5e+58: tmp = x elif y <= -1.0: tmp = 1.0 / y elif y <= 5e-16: tmp = 1.0 + (y * (x + -1.0)) elif y <= 3e+105: tmp = y * (x / (y + 1.0)) elif y <= 2.6e+139: tmp = 1.0 / y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -7.5e+58) tmp = x; elseif (y <= -1.0) tmp = Float64(1.0 / y); elseif (y <= 5e-16) tmp = Float64(1.0 + Float64(y * Float64(x + -1.0))); elseif (y <= 3e+105) tmp = Float64(y * Float64(x / Float64(y + 1.0))); elseif (y <= 2.6e+139) tmp = Float64(1.0 / y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -7.5e+58) tmp = x; elseif (y <= -1.0) tmp = 1.0 / y; elseif (y <= 5e-16) tmp = 1.0 + (y * (x + -1.0)); elseif (y <= 3e+105) tmp = y * (x / (y + 1.0)); elseif (y <= 2.6e+139) tmp = 1.0 / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7.5e+58], x, If[LessEqual[y, -1.0], N[(1.0 / y), $MachinePrecision], If[LessEqual[y, 5e-16], N[(1.0 + N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3e+105], N[(y * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.6e+139], N[(1.0 / y), $MachinePrecision], x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+58}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-16}:\\
\;\;\;\;1 + y \cdot \left(x + -1\right)\\
\mathbf{elif}\;y \leq 3 \cdot 10^{+105}:\\
\;\;\;\;y \cdot \frac{x}{y + 1}\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+139}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -7.5000000000000001e58 or 2.60000000000000022e139 < y Initial program 26.1%
associate-/l*56.8%
remove-double-neg56.8%
remove-double-neg56.8%
+-commutative56.8%
Simplified56.8%
Taylor expanded in y around inf 84.5%
if -7.5000000000000001e58 < y < -1 or 3.0000000000000001e105 < y < 2.60000000000000022e139Initial program 29.6%
sub-neg29.6%
+-commutative29.6%
*-commutative29.6%
associate-/l*32.8%
distribute-rgt-neg-in32.8%
fma-define34.0%
distribute-frac-neg234.0%
+-commutative34.0%
distribute-neg-in34.0%
metadata-eval34.0%
unsub-neg34.0%
Simplified34.0%
Taylor expanded in x around 0 17.5%
metadata-eval17.5%
distribute-neg-frac17.5%
distribute-neg-frac217.5%
distribute-neg-in17.5%
metadata-eval17.5%
sub-neg17.5%
Simplified17.5%
Taylor expanded in y around inf 76.1%
Taylor expanded in y around inf 72.4%
if -1 < y < 5.0000000000000004e-16Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 99.4%
if 5.0000000000000004e-16 < y < 3.0000000000000001e105Initial program 61.0%
associate-/l*67.0%
remove-double-neg67.0%
remove-double-neg67.0%
+-commutative67.0%
Simplified67.0%
Taylor expanded in x around inf 61.4%
*-commutative61.4%
associate-/l*67.4%
Simplified67.4%
Final simplification87.7%
(FPCore (x y) :precision binary64 (if (or (<= y -135000000.0) (not (<= y 135000000.0))) (+ x (/ (- 1.0 x) y)) (+ 1.0 (* (/ y (+ y 1.0)) (+ x -1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -135000000.0) || !(y <= 135000000.0)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 + ((y / (y + 1.0)) * (x + -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 <= (-135000000.0d0)) .or. (.not. (y <= 135000000.0d0))) then
tmp = x + ((1.0d0 - x) / y)
else
tmp = 1.0d0 + ((y / (y + 1.0d0)) * (x + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -135000000.0) || !(y <= 135000000.0)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 + ((y / (y + 1.0)) * (x + -1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -135000000.0) or not (y <= 135000000.0): tmp = x + ((1.0 - x) / y) else: tmp = 1.0 + ((y / (y + 1.0)) * (x + -1.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -135000000.0) || !(y <= 135000000.0)) tmp = Float64(x + Float64(Float64(1.0 - x) / y)); else tmp = Float64(1.0 + Float64(Float64(y / Float64(y + 1.0)) * Float64(x + -1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -135000000.0) || ~((y <= 135000000.0))) tmp = x + ((1.0 - x) / y); else tmp = 1.0 + ((y / (y + 1.0)) * (x + -1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -135000000.0], N[Not[LessEqual[y, 135000000.0]], $MachinePrecision]], N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -135000000 \lor \neg \left(y \leq 135000000\right):\\
\;\;\;\;x + \frac{1 - x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y}{y + 1} \cdot \left(x + -1\right)\\
\end{array}
\end{array}
if y < -1.35e8 or 1.35e8 < y Initial program 28.3%
associate-/l*50.3%
remove-double-neg50.3%
remove-double-neg50.3%
+-commutative50.3%
Simplified50.3%
Taylor expanded in y around inf 99.4%
associate--l+99.4%
div-sub99.4%
remove-double-neg99.4%
neg-sub099.4%
associate--r-99.4%
metadata-eval99.4%
+-commutative99.4%
metadata-eval99.4%
sub-neg99.4%
distribute-neg-frac99.4%
unsub-neg99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
if -1.35e8 < y < 1.35e8Initial program 99.4%
associate-/l*99.4%
remove-double-neg99.4%
remove-double-neg99.4%
+-commutative99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x y) :precision binary64 (if (or (<= y -52000000.0) (not (<= y 116000000.0))) (+ x (/ (- 1.0 x) y)) (+ 1.0 (/ (* y (- 1.0 x)) (- -1.0 y)))))
double code(double x, double y) {
double tmp;
if ((y <= -52000000.0) || !(y <= 116000000.0)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 + ((y * (1.0 - x)) / (-1.0 - y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-52000000.0d0)) .or. (.not. (y <= 116000000.0d0))) then
tmp = x + ((1.0d0 - x) / y)
else
tmp = 1.0d0 + ((y * (1.0d0 - x)) / ((-1.0d0) - y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -52000000.0) || !(y <= 116000000.0)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 + ((y * (1.0 - x)) / (-1.0 - y));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -52000000.0) or not (y <= 116000000.0): tmp = x + ((1.0 - x) / y) else: tmp = 1.0 + ((y * (1.0 - x)) / (-1.0 - y)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -52000000.0) || !(y <= 116000000.0)) tmp = Float64(x + Float64(Float64(1.0 - x) / y)); else tmp = Float64(1.0 + Float64(Float64(y * Float64(1.0 - x)) / Float64(-1.0 - y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -52000000.0) || ~((y <= 116000000.0))) tmp = x + ((1.0 - x) / y); else tmp = 1.0 + ((y * (1.0 - x)) / (-1.0 - y)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -52000000.0], N[Not[LessEqual[y, 116000000.0]], $MachinePrecision]], N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(y * N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -52000000 \lor \neg \left(y \leq 116000000\right):\\
\;\;\;\;x + \frac{1 - x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y \cdot \left(1 - x\right)}{-1 - y}\\
\end{array}
\end{array}
if y < -5.2e7 or 1.16e8 < y Initial program 28.3%
associate-/l*50.3%
remove-double-neg50.3%
remove-double-neg50.3%
+-commutative50.3%
Simplified50.3%
Taylor expanded in y around inf 99.4%
associate--l+99.4%
div-sub99.4%
remove-double-neg99.4%
neg-sub099.4%
associate--r-99.4%
metadata-eval99.4%
+-commutative99.4%
metadata-eval99.4%
sub-neg99.4%
distribute-neg-frac99.4%
unsub-neg99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
if -5.2e7 < y < 1.16e8Initial program 99.4%
Final simplification99.4%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (+ x (/ (- 1.0 x) y)) (+ 1.0 (* y (+ x -1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 + (y * (x + -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 <= (-1.0d0)) .or. (.not. (y <= 1.0d0))) then
tmp = x + ((1.0d0 - x) / y)
else
tmp = 1.0d0 + (y * (x + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 + (y * (x + -1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 1.0): tmp = x + ((1.0 - x) / y) else: tmp = 1.0 + (y * (x + -1.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.0)) tmp = Float64(x + Float64(Float64(1.0 - x) / y)); else tmp = Float64(1.0 + Float64(y * Float64(x + -1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.0) || ~((y <= 1.0))) tmp = x + ((1.0 - x) / y); else tmp = 1.0 + (y * (x + -1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;x + \frac{1 - x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \left(x + -1\right)\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 32.5%
associate-/l*53.0%
remove-double-neg53.0%
remove-double-neg53.0%
+-commutative53.0%
Simplified53.0%
Taylor expanded in y around inf 96.6%
associate--l+96.6%
div-sub96.6%
remove-double-neg96.6%
neg-sub096.6%
associate--r-96.6%
metadata-eval96.6%
+-commutative96.6%
metadata-eval96.6%
sub-neg96.6%
distribute-neg-frac96.6%
unsub-neg96.6%
sub-neg96.6%
metadata-eval96.6%
Simplified96.6%
if -1 < y < 1Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 98.3%
Final simplification97.3%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 5e-16) (- 1.0 y) x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 5e-16) {
tmp = 1.0 - y;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.0d0)) then
tmp = x
else if (y <= 5d-16) then
tmp = 1.0d0 - y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 5e-16) {
tmp = 1.0 - y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 5e-16: tmp = 1.0 - y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 5e-16) tmp = Float64(1.0 - y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = x; elseif (y <= 5e-16) tmp = 1.0 - y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 5e-16], N[(1.0 - y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-16}:\\
\;\;\;\;1 - y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 5.0000000000000004e-16 < y Initial program 33.9%
associate-/l*54.0%
remove-double-neg54.0%
remove-double-neg54.0%
+-commutative54.0%
Simplified54.0%
Taylor expanded in y around inf 64.8%
if -1 < y < 5.0000000000000004e-16Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
*-commutative100.0%
associate-/l*100.0%
distribute-rgt-neg-in100.0%
fma-define100.0%
distribute-frac-neg2100.0%
+-commutative100.0%
distribute-neg-in100.0%
metadata-eval100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 83.9%
metadata-eval83.9%
distribute-neg-frac83.9%
distribute-neg-frac283.9%
distribute-neg-in83.9%
metadata-eval83.9%
sub-neg83.9%
Simplified83.9%
Taylor expanded in y around 0 83.3%
neg-mul-183.3%
unsub-neg83.3%
Simplified83.3%
Final simplification72.9%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 5e-16) 1.0 x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 5e-16) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.0d0)) then
tmp = x
else if (y <= 5d-16) then
tmp = 1.0d0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 5e-16) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 5e-16: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 5e-16) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = x; elseif (y <= 5e-16) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 5e-16], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-16}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 5.0000000000000004e-16 < y Initial program 33.9%
associate-/l*54.0%
remove-double-neg54.0%
remove-double-neg54.0%
+-commutative54.0%
Simplified54.0%
Taylor expanded in y around inf 64.8%
if -1 < y < 5.0000000000000004e-16Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 82.9%
Final simplification72.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 63.1%
associate-/l*74.3%
remove-double-neg74.3%
remove-double-neg74.3%
+-commutative74.3%
Simplified74.3%
Taylor expanded in y around 0 38.7%
Final simplification38.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- (/ 1.0 y) (- (/ x y) x))))
(if (< y -3693.8482788297247)
t_0
(if (< y 6799310503.41891) (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))) t_0))))
double code(double x, double y) {
double t_0 = (1.0 / y) - ((x / y) - x);
double tmp;
if (y < -3693.8482788297247) {
tmp = t_0;
} else if (y < 6799310503.41891) {
tmp = 1.0 - (((1.0 - x) * y) / (y + 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 / y) - x)
if (y < (-3693.8482788297247d0)) then
tmp = t_0
else if (y < 6799310503.41891d0) then
tmp = 1.0d0 - (((1.0d0 - x) * y) / (y + 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 / y) - x);
double tmp;
if (y < -3693.8482788297247) {
tmp = t_0;
} else if (y < 6799310503.41891) {
tmp = 1.0 - (((1.0 - x) * y) / (y + 1.0));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (1.0 / y) - ((x / y) - x) tmp = 0 if y < -3693.8482788297247: tmp = t_0 elif y < 6799310503.41891: tmp = 1.0 - (((1.0 - x) * y) / (y + 1.0)) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(1.0 / y) - Float64(Float64(x / y) - x)) tmp = 0.0 if (y < -3693.8482788297247) tmp = t_0; elseif (y < 6799310503.41891) tmp = Float64(1.0 - Float64(Float64(Float64(1.0 - x) * y) / Float64(y + 1.0))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (1.0 / y) - ((x / y) - x); tmp = 0.0; if (y < -3693.8482788297247) tmp = t_0; elseif (y < 6799310503.41891) tmp = 1.0 - (((1.0 - x) * y) / (y + 1.0)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(1.0 / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -3693.8482788297247], t$95$0, If[Less[y, 6799310503.41891], N[(1.0 - N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{y} - \left(\frac{x}{y} - x\right)\\
\mathbf{if}\;y < -3693.8482788297247:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y < 6799310503.41891:\\
\;\;\;\;1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
herbie shell --seed 2024044
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, D"
:precision binary64
:herbie-target
(if (< y -3693.8482788297247) (- (/ 1.0 y) (- (/ x y) x)) (if (< y 6799310503.41891) (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))) (- (/ 1.0 y) (- (/ x y) x))))
(- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))