
(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
(if (or (<= y -190000.0) (not (<= y 14000.0)))
(+
(+ x (- (/ (- 1.0 x) (pow y 3.0)) (/ (+ x -1.0) y)))
(/ (+ x -1.0) (* y y)))
(+ 1.0 (/ (* y (+ x -1.0)) (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -190000.0) || !(y <= 14000.0)) {
tmp = (x + (((1.0 - x) / pow(y, 3.0)) - ((x + -1.0) / y))) + ((x + -1.0) / (y * y));
} else {
tmp = 1.0 + ((y * (x + -1.0)) / (y + 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 <= (-190000.0d0)) .or. (.not. (y <= 14000.0d0))) then
tmp = (x + (((1.0d0 - x) / (y ** 3.0d0)) - ((x + (-1.0d0)) / y))) + ((x + (-1.0d0)) / (y * y))
else
tmp = 1.0d0 + ((y * (x + (-1.0d0))) / (y + 1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -190000.0) || !(y <= 14000.0)) {
tmp = (x + (((1.0 - x) / Math.pow(y, 3.0)) - ((x + -1.0) / y))) + ((x + -1.0) / (y * y));
} else {
tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -190000.0) or not (y <= 14000.0): tmp = (x + (((1.0 - x) / math.pow(y, 3.0)) - ((x + -1.0) / y))) + ((x + -1.0) / (y * y)) else: tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -190000.0) || !(y <= 14000.0)) tmp = Float64(Float64(x + Float64(Float64(Float64(1.0 - x) / (y ^ 3.0)) - Float64(Float64(x + -1.0) / y))) + Float64(Float64(x + -1.0) / Float64(y * y))); else tmp = Float64(1.0 + Float64(Float64(y * Float64(x + -1.0)) / Float64(y + 1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -190000.0) || ~((y <= 14000.0))) tmp = (x + (((1.0 - x) / (y ^ 3.0)) - ((x + -1.0) / y))) + ((x + -1.0) / (y * y)); else tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -190000.0], N[Not[LessEqual[y, 14000.0]], $MachinePrecision]], N[(N[(x + N[(N[(N[(1.0 - x), $MachinePrecision] / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision] - N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x + -1.0), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -190000 \lor \neg \left(y \leq 14000\right):\\
\;\;\;\;\left(x + \left(\frac{1 - x}{{y}^{3}} - \frac{x + -1}{y}\right)\right) + \frac{x + -1}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y \cdot \left(x + -1\right)}{y + 1}\\
\end{array}
\end{array}
if y < -1.9e5 or 14000 < y Initial program 29.7%
sub-neg29.7%
+-commutative29.7%
associate-/l*57.2%
distribute-neg-frac57.2%
*-lft-identity57.2%
associate-*l/57.2%
fma-def57.2%
associate-/l*57.2%
*-lft-identity57.2%
+-commutative57.2%
neg-sub057.2%
associate--r-57.2%
metadata-eval57.2%
+-commutative57.2%
Simplified57.2%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate--l+100.0%
Simplified100.0%
if -1.9e5 < y < 14000Initial program 100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (if (or (<= y -210000.0) (not (<= y 300000.0))) (+ (/ (+ x -1.0) (* y y)) (- x (/ (+ x -1.0) y))) (+ 1.0 (/ (* y (+ x -1.0)) (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -210000.0) || !(y <= 300000.0)) {
tmp = ((x + -1.0) / (y * y)) + (x - ((x + -1.0) / y));
} else {
tmp = 1.0 + ((y * (x + -1.0)) / (y + 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 <= (-210000.0d0)) .or. (.not. (y <= 300000.0d0))) then
tmp = ((x + (-1.0d0)) / (y * y)) + (x - ((x + (-1.0d0)) / y))
else
tmp = 1.0d0 + ((y * (x + (-1.0d0))) / (y + 1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -210000.0) || !(y <= 300000.0)) {
tmp = ((x + -1.0) / (y * y)) + (x - ((x + -1.0) / y));
} else {
tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -210000.0) or not (y <= 300000.0): tmp = ((x + -1.0) / (y * y)) + (x - ((x + -1.0) / y)) else: tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -210000.0) || !(y <= 300000.0)) tmp = Float64(Float64(Float64(x + -1.0) / Float64(y * y)) + Float64(x - Float64(Float64(x + -1.0) / y))); else tmp = Float64(1.0 + Float64(Float64(y * Float64(x + -1.0)) / Float64(y + 1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -210000.0) || ~((y <= 300000.0))) tmp = ((x + -1.0) / (y * y)) + (x - ((x + -1.0) / y)); else tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -210000.0], N[Not[LessEqual[y, 300000.0]], $MachinePrecision]], N[(N[(N[(x + -1.0), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(x - N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -210000 \lor \neg \left(y \leq 300000\right):\\
\;\;\;\;\frac{x + -1}{y \cdot y} + \left(x - \frac{x + -1}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y \cdot \left(x + -1\right)}{y + 1}\\
\end{array}
\end{array}
if y < -2.1e5 or 3e5 < y Initial program 29.1%
sub-neg29.1%
+-commutative29.1%
associate-/l*56.8%
distribute-neg-frac56.8%
*-lft-identity56.8%
associate-*l/56.8%
fma-def56.8%
associate-/l*56.8%
*-lft-identity56.8%
+-commutative56.8%
neg-sub056.8%
associate--r-56.8%
metadata-eval56.8%
+-commutative56.8%
Simplified56.8%
Taylor expanded in y around inf 99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
mul-1-neg99.7%
unsub-neg99.7%
sub-neg99.7%
metadata-eval99.7%
div-sub99.7%
sub-neg99.7%
metadata-eval99.7%
unpow299.7%
Simplified99.7%
if -2.1e5 < y < 3e5Initial program 100.0%
Final simplification99.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- x (/ x y))))
(if (<= y -8.5e+119)
x
(if (<= y -4.5e+88)
(/ 1.0 y)
(if (<= y -1.0)
t_0
(if (<= y -2.6e-55) (* y x) (if (<= y 1.0) (- 1.0 y) t_0)))))))
double code(double x, double y) {
double t_0 = x - (x / y);
double tmp;
if (y <= -8.5e+119) {
tmp = x;
} else if (y <= -4.5e+88) {
tmp = 1.0 / y;
} else if (y <= -1.0) {
tmp = t_0;
} else if (y <= -2.6e-55) {
tmp = y * x;
} else if (y <= 1.0) {
tmp = 1.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 = x - (x / y)
if (y <= (-8.5d+119)) then
tmp = x
else if (y <= (-4.5d+88)) then
tmp = 1.0d0 / y
else if (y <= (-1.0d0)) then
tmp = t_0
else if (y <= (-2.6d-55)) then
tmp = y * x
else if (y <= 1.0d0) then
tmp = 1.0d0 - y
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x - (x / y);
double tmp;
if (y <= -8.5e+119) {
tmp = x;
} else if (y <= -4.5e+88) {
tmp = 1.0 / y;
} else if (y <= -1.0) {
tmp = t_0;
} else if (y <= -2.6e-55) {
tmp = y * x;
} else if (y <= 1.0) {
tmp = 1.0 - y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x - (x / y) tmp = 0 if y <= -8.5e+119: tmp = x elif y <= -4.5e+88: tmp = 1.0 / y elif y <= -1.0: tmp = t_0 elif y <= -2.6e-55: tmp = y * x elif y <= 1.0: tmp = 1.0 - y else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x - Float64(x / y)) tmp = 0.0 if (y <= -8.5e+119) tmp = x; elseif (y <= -4.5e+88) tmp = Float64(1.0 / y); elseif (y <= -1.0) tmp = t_0; elseif (y <= -2.6e-55) tmp = Float64(y * x); elseif (y <= 1.0) tmp = Float64(1.0 - y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = x - (x / y); tmp = 0.0; if (y <= -8.5e+119) tmp = x; elseif (y <= -4.5e+88) tmp = 1.0 / y; elseif (y <= -1.0) tmp = t_0; elseif (y <= -2.6e-55) tmp = y * x; elseif (y <= 1.0) tmp = 1.0 - y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x - N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8.5e+119], x, If[LessEqual[y, -4.5e+88], N[(1.0 / y), $MachinePrecision], If[LessEqual[y, -1.0], t$95$0, If[LessEqual[y, -2.6e-55], N[(y * x), $MachinePrecision], If[LessEqual[y, 1.0], N[(1.0 - y), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x - \frac{x}{y}\\
\mathbf{if}\;y \leq -8.5 \cdot 10^{+119}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -4.5 \cdot 10^{+88}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{elif}\;y \leq -1:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -2.6 \cdot 10^{-55}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;1 - y\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -8.49999999999999997e119Initial program 18.1%
sub-neg18.1%
+-commutative18.1%
associate-/l*57.3%
distribute-neg-frac57.3%
*-lft-identity57.3%
associate-*l/57.3%
fma-def57.3%
associate-/l*57.3%
*-lft-identity57.3%
+-commutative57.3%
neg-sub057.3%
associate--r-57.3%
metadata-eval57.3%
+-commutative57.3%
Simplified57.3%
Taylor expanded in y around inf 77.6%
if -8.49999999999999997e119 < y < -4.5e88Initial program 23.2%
sub-neg23.2%
+-commutative23.2%
associate-/l*23.2%
distribute-neg-frac23.2%
*-lft-identity23.2%
associate-*l/23.2%
fma-def23.2%
associate-/l*23.2%
*-lft-identity23.2%
+-commutative23.2%
neg-sub023.2%
associate--r-23.2%
metadata-eval23.2%
+-commutative23.2%
Simplified23.2%
Taylor expanded in x around 0 3.8%
mul-1-neg3.8%
sub-neg3.8%
Simplified3.8%
Taylor expanded in y around inf 80.4%
if -4.5e88 < y < -1 or 1 < y Initial program 38.5%
sub-neg38.5%
+-commutative38.5%
associate-/l*62.6%
distribute-neg-frac62.6%
*-lft-identity62.6%
associate-*l/62.6%
fma-def62.6%
associate-/l*62.6%
*-lft-identity62.6%
+-commutative62.6%
neg-sub062.6%
associate--r-62.6%
metadata-eval62.6%
+-commutative62.6%
Simplified62.6%
Taylor expanded in x around inf 52.4%
associate-/l*67.7%
Simplified67.7%
Taylor expanded in y around inf 75.3%
mul-1-neg75.3%
distribute-frac-neg75.3%
+-commutative75.3%
distribute-frac-neg75.3%
sub-neg75.3%
Simplified75.3%
if -1 < y < -2.5999999999999999e-55Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
associate-/l*99.3%
distribute-neg-frac99.3%
*-lft-identity99.3%
associate-*l/99.7%
fma-def99.7%
associate-/l*99.9%
*-lft-identity99.9%
+-commutative99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 73.5%
associate-/l*73.0%
Simplified73.0%
Taylor expanded in y around 0 66.3%
if -2.5999999999999999e-55 < y < 1Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
associate-/l*99.9%
distribute-neg-frac99.9%
*-lft-identity99.9%
associate-*l/99.9%
fma-def99.9%
associate-/l*100.0%
*-lft-identity100.0%
+-commutative100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 71.3%
mul-1-neg71.3%
sub-neg71.3%
Simplified71.3%
Taylor expanded in y around 0 71.3%
neg-mul-171.3%
unsub-neg71.3%
Simplified71.3%
Final simplification73.6%
(FPCore (x y)
:precision binary64
(if (<= y -8.5e+119)
x
(if (<= y -4.5e+88)
(/ 1.0 y)
(if (or (<= y -1.0) (not (<= y 1.1)))
(- x (/ x y))
(+ 1.0 (- (* y x) y))))))
double code(double x, double y) {
double tmp;
if (y <= -8.5e+119) {
tmp = x;
} else if (y <= -4.5e+88) {
tmp = 1.0 / y;
} else if ((y <= -1.0) || !(y <= 1.1)) {
tmp = x - (x / y);
} else {
tmp = 1.0 + ((y * x) - y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-8.5d+119)) then
tmp = x
else if (y <= (-4.5d+88)) then
tmp = 1.0d0 / y
else if ((y <= (-1.0d0)) .or. (.not. (y <= 1.1d0))) then
tmp = x - (x / y)
else
tmp = 1.0d0 + ((y * x) - y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -8.5e+119) {
tmp = x;
} else if (y <= -4.5e+88) {
tmp = 1.0 / y;
} else if ((y <= -1.0) || !(y <= 1.1)) {
tmp = x - (x / y);
} else {
tmp = 1.0 + ((y * x) - y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -8.5e+119: tmp = x elif y <= -4.5e+88: tmp = 1.0 / y elif (y <= -1.0) or not (y <= 1.1): tmp = x - (x / y) else: tmp = 1.0 + ((y * x) - y) return tmp
function code(x, y) tmp = 0.0 if (y <= -8.5e+119) tmp = x; elseif (y <= -4.5e+88) tmp = Float64(1.0 / y); elseif ((y <= -1.0) || !(y <= 1.1)) tmp = Float64(x - Float64(x / y)); else tmp = Float64(1.0 + Float64(Float64(y * x) - y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -8.5e+119) tmp = x; elseif (y <= -4.5e+88) tmp = 1.0 / y; elseif ((y <= -1.0) || ~((y <= 1.1))) tmp = x - (x / y); else tmp = 1.0 + ((y * x) - y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -8.5e+119], x, If[LessEqual[y, -4.5e+88], N[(1.0 / y), $MachinePrecision], If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.1]], $MachinePrecision]], N[(x - N[(x / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(y * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{+119}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -4.5 \cdot 10^{+88}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{elif}\;y \leq -1 \lor \neg \left(y \leq 1.1\right):\\
\;\;\;\;x - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(y \cdot x - y\right)\\
\end{array}
\end{array}
if y < -8.49999999999999997e119Initial program 18.1%
sub-neg18.1%
+-commutative18.1%
associate-/l*57.3%
distribute-neg-frac57.3%
*-lft-identity57.3%
associate-*l/57.3%
fma-def57.3%
associate-/l*57.3%
*-lft-identity57.3%
+-commutative57.3%
neg-sub057.3%
associate--r-57.3%
metadata-eval57.3%
+-commutative57.3%
Simplified57.3%
Taylor expanded in y around inf 77.6%
if -8.49999999999999997e119 < y < -4.5e88Initial program 23.2%
sub-neg23.2%
+-commutative23.2%
associate-/l*23.2%
distribute-neg-frac23.2%
*-lft-identity23.2%
associate-*l/23.2%
fma-def23.2%
associate-/l*23.2%
*-lft-identity23.2%
+-commutative23.2%
neg-sub023.2%
associate--r-23.2%
metadata-eval23.2%
+-commutative23.2%
Simplified23.2%
Taylor expanded in x around 0 3.8%
mul-1-neg3.8%
sub-neg3.8%
Simplified3.8%
Taylor expanded in y around inf 80.4%
if -4.5e88 < y < -1 or 1.1000000000000001 < y Initial program 38.5%
sub-neg38.5%
+-commutative38.5%
associate-/l*62.6%
distribute-neg-frac62.6%
*-lft-identity62.6%
associate-*l/62.6%
fma-def62.6%
associate-/l*62.6%
*-lft-identity62.6%
+-commutative62.6%
neg-sub062.6%
associate--r-62.6%
metadata-eval62.6%
+-commutative62.6%
Simplified62.6%
Taylor expanded in x around inf 52.4%
associate-/l*67.7%
Simplified67.7%
Taylor expanded in y around inf 75.3%
mul-1-neg75.3%
distribute-frac-neg75.3%
+-commutative75.3%
distribute-frac-neg75.3%
sub-neg75.3%
Simplified75.3%
if -1 < y < 1.1000000000000001Initial program 100.0%
sub-neg100.0%
distribute-neg-frac100.0%
neg-mul-1100.0%
associate-*l/100.0%
metadata-eval100.0%
associate-*l/100.0%
associate-/r/100.0%
metadata-eval100.0%
distribute-neg-frac100.0%
cancel-sign-sub-inv100.0%
associate-/r/99.9%
associate-/r*99.9%
neg-mul-199.9%
associate-/r/100.0%
distribute-rgt-neg-in100.0%
associate-/r/99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
associate-/r/100.0%
Simplified99.9%
Taylor expanded in y around 0 97.9%
sub-neg97.9%
distribute-lft-in97.9%
*-rgt-identity97.9%
distribute-rgt-neg-out97.9%
unsub-neg97.9%
Simplified97.9%
Final simplification87.2%
(FPCore (x y) :precision binary64 (if (or (<= y -180000000.0) (not (<= y 170000000.0))) (- x (/ (+ x -1.0) y)) (+ 1.0 (* y (/ (+ x -1.0) (+ y 1.0))))))
double code(double x, double y) {
double tmp;
if ((y <= -180000000.0) || !(y <= 170000000.0)) {
tmp = x - ((x + -1.0) / y);
} else {
tmp = 1.0 + (y * ((x + -1.0) / (y + 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 <= (-180000000.0d0)) .or. (.not. (y <= 170000000.0d0))) then
tmp = x - ((x + (-1.0d0)) / y)
else
tmp = 1.0d0 + (y * ((x + (-1.0d0)) / (y + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -180000000.0) || !(y <= 170000000.0)) {
tmp = x - ((x + -1.0) / y);
} else {
tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -180000000.0) or not (y <= 170000000.0): tmp = x - ((x + -1.0) / y) else: tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0))) return tmp
function code(x, y) tmp = 0.0 if ((y <= -180000000.0) || !(y <= 170000000.0)) tmp = Float64(x - Float64(Float64(x + -1.0) / y)); else tmp = Float64(1.0 + Float64(y * Float64(Float64(x + -1.0) / Float64(y + 1.0)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -180000000.0) || ~((y <= 170000000.0))) tmp = x - ((x + -1.0) / y); else tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -180000000.0], N[Not[LessEqual[y, 170000000.0]], $MachinePrecision]], N[(x - N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(N[(x + -1.0), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -180000000 \lor \neg \left(y \leq 170000000\right):\\
\;\;\;\;x - \frac{x + -1}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\
\end{array}
\end{array}
if y < -1.8e8 or 1.7e8 < y Initial program 28.4%
sub-neg28.4%
+-commutative28.4%
associate-/l*56.6%
distribute-neg-frac56.6%
*-lft-identity56.6%
associate-*l/56.6%
fma-def56.6%
associate-/l*56.6%
*-lft-identity56.6%
+-commutative56.6%
neg-sub056.6%
associate--r-56.6%
metadata-eval56.6%
+-commutative56.6%
Simplified56.6%
Taylor expanded in y around inf 99.4%
+-commutative99.4%
mul-1-neg99.4%
unsub-neg99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
if -1.8e8 < y < 1.7e8Initial program 99.6%
sub-neg99.6%
distribute-neg-frac99.6%
neg-mul-199.6%
associate-*l/99.5%
metadata-eval99.5%
associate-*l/99.5%
associate-/r/99.5%
metadata-eval99.5%
distribute-neg-frac99.5%
cancel-sign-sub-inv99.5%
associate-/r/99.5%
associate-/r*99.5%
neg-mul-199.5%
associate-/r/99.5%
distribute-rgt-neg-in99.5%
associate-/r/99.5%
distribute-neg-frac99.5%
metadata-eval99.5%
associate-/r/99.5%
Simplified99.5%
Final simplification99.4%
(FPCore (x y) :precision binary64 (if (or (<= y -18000000000.0) (not (<= y 160000000.0))) (- x (/ (+ x -1.0) y)) (+ 1.0 (/ (* y (+ x -1.0)) (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -18000000000.0) || !(y <= 160000000.0)) {
tmp = x - ((x + -1.0) / y);
} else {
tmp = 1.0 + ((y * (x + -1.0)) / (y + 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 <= (-18000000000.0d0)) .or. (.not. (y <= 160000000.0d0))) then
tmp = x - ((x + (-1.0d0)) / y)
else
tmp = 1.0d0 + ((y * (x + (-1.0d0))) / (y + 1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -18000000000.0) || !(y <= 160000000.0)) {
tmp = x - ((x + -1.0) / y);
} else {
tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -18000000000.0) or not (y <= 160000000.0): tmp = x - ((x + -1.0) / y) else: tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -18000000000.0) || !(y <= 160000000.0)) tmp = Float64(x - Float64(Float64(x + -1.0) / y)); else tmp = Float64(1.0 + Float64(Float64(y * Float64(x + -1.0)) / Float64(y + 1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -18000000000.0) || ~((y <= 160000000.0))) tmp = x - ((x + -1.0) / y); else tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -18000000000.0], N[Not[LessEqual[y, 160000000.0]], $MachinePrecision]], N[(x - N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -18000000000 \lor \neg \left(y \leq 160000000\right):\\
\;\;\;\;x - \frac{x + -1}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y \cdot \left(x + -1\right)}{y + 1}\\
\end{array}
\end{array}
if y < -1.8e10 or 1.6e8 < y Initial program 27.3%
sub-neg27.3%
+-commutative27.3%
associate-/l*55.8%
distribute-neg-frac55.8%
*-lft-identity55.8%
associate-*l/55.8%
fma-def55.8%
associate-/l*55.9%
*-lft-identity55.9%
+-commutative55.9%
neg-sub055.9%
associate--r-55.9%
metadata-eval55.9%
+-commutative55.9%
Simplified55.9%
Taylor expanded in y around inf 99.4%
+-commutative99.4%
mul-1-neg99.4%
unsub-neg99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
if -1.8e10 < y < 1.6e8Initial program 99.6%
Final simplification99.5%
(FPCore (x y)
:precision binary64
(if (<= y -8.5e+119)
x
(if (<= y -4.3e+88)
(/ 1.0 y)
(if (or (<= y -1.0) (not (<= y 3.0))) (- x (/ x y)) (+ 1.0 (* y x))))))
double code(double x, double y) {
double tmp;
if (y <= -8.5e+119) {
tmp = x;
} else if (y <= -4.3e+88) {
tmp = 1.0 / y;
} else if ((y <= -1.0) || !(y <= 3.0)) {
tmp = x - (x / y);
} 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 (y <= (-8.5d+119)) then
tmp = x
else if (y <= (-4.3d+88)) then
tmp = 1.0d0 / y
else if ((y <= (-1.0d0)) .or. (.not. (y <= 3.0d0))) then
tmp = x - (x / y)
else
tmp = 1.0d0 + (y * x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -8.5e+119) {
tmp = x;
} else if (y <= -4.3e+88) {
tmp = 1.0 / y;
} else if ((y <= -1.0) || !(y <= 3.0)) {
tmp = x - (x / y);
} else {
tmp = 1.0 + (y * x);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -8.5e+119: tmp = x elif y <= -4.3e+88: tmp = 1.0 / y elif (y <= -1.0) or not (y <= 3.0): tmp = x - (x / y) else: tmp = 1.0 + (y * x) return tmp
function code(x, y) tmp = 0.0 if (y <= -8.5e+119) tmp = x; elseif (y <= -4.3e+88) tmp = Float64(1.0 / y); elseif ((y <= -1.0) || !(y <= 3.0)) tmp = Float64(x - Float64(x / y)); else tmp = Float64(1.0 + Float64(y * x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -8.5e+119) tmp = x; elseif (y <= -4.3e+88) tmp = 1.0 / y; elseif ((y <= -1.0) || ~((y <= 3.0))) tmp = x - (x / y); else tmp = 1.0 + (y * x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -8.5e+119], x, If[LessEqual[y, -4.3e+88], N[(1.0 / y), $MachinePrecision], If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 3.0]], $MachinePrecision]], N[(x - N[(x / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{+119}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -4.3 \cdot 10^{+88}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{elif}\;y \leq -1 \lor \neg \left(y \leq 3\right):\\
\;\;\;\;x - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot x\\
\end{array}
\end{array}
if y < -8.49999999999999997e119Initial program 18.1%
sub-neg18.1%
+-commutative18.1%
associate-/l*57.3%
distribute-neg-frac57.3%
*-lft-identity57.3%
associate-*l/57.3%
fma-def57.3%
associate-/l*57.3%
*-lft-identity57.3%
+-commutative57.3%
neg-sub057.3%
associate--r-57.3%
metadata-eval57.3%
+-commutative57.3%
Simplified57.3%
Taylor expanded in y around inf 77.6%
if -8.49999999999999997e119 < y < -4.29999999999999974e88Initial program 23.2%
sub-neg23.2%
+-commutative23.2%
associate-/l*23.2%
distribute-neg-frac23.2%
*-lft-identity23.2%
associate-*l/23.2%
fma-def23.2%
associate-/l*23.2%
*-lft-identity23.2%
+-commutative23.2%
neg-sub023.2%
associate--r-23.2%
metadata-eval23.2%
+-commutative23.2%
Simplified23.2%
Taylor expanded in x around 0 3.8%
mul-1-neg3.8%
sub-neg3.8%
Simplified3.8%
Taylor expanded in y around inf 80.4%
if -4.29999999999999974e88 < y < -1 or 3 < y Initial program 38.5%
sub-neg38.5%
+-commutative38.5%
associate-/l*62.6%
distribute-neg-frac62.6%
*-lft-identity62.6%
associate-*l/62.6%
fma-def62.6%
associate-/l*62.6%
*-lft-identity62.6%
+-commutative62.6%
neg-sub062.6%
associate--r-62.6%
metadata-eval62.6%
+-commutative62.6%
Simplified62.6%
Taylor expanded in x around inf 52.4%
associate-/l*67.7%
Simplified67.7%
Taylor expanded in y around inf 75.3%
mul-1-neg75.3%
distribute-frac-neg75.3%
+-commutative75.3%
distribute-frac-neg75.3%
sub-neg75.3%
Simplified75.3%
if -1 < y < 3Initial program 100.0%
sub-neg100.0%
distribute-neg-frac100.0%
neg-mul-1100.0%
associate-*l/100.0%
metadata-eval100.0%
associate-*l/100.0%
associate-/r/100.0%
metadata-eval100.0%
distribute-neg-frac100.0%
cancel-sign-sub-inv100.0%
associate-/r/99.9%
associate-/r*99.9%
neg-mul-199.9%
associate-/r/100.0%
distribute-rgt-neg-in100.0%
associate-/r/99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
associate-/r/100.0%
Simplified99.9%
Taylor expanded in y around 0 97.9%
sub-neg97.9%
distribute-lft-in97.9%
*-rgt-identity97.9%
distribute-rgt-neg-out97.9%
unsub-neg97.9%
Simplified97.9%
Taylor expanded in x around inf 97.4%
mul-1-neg97.4%
distribute-rgt-neg-in97.4%
Simplified97.4%
Final simplification86.9%
(FPCore (x y)
:precision binary64
(if (<= y -8.5e+119)
x
(if (<= y -1.0)
(/ 1.0 y)
(if (<= y -3.05e-56) (* y x) (if (<= y 0.045) (- 1.0 y) x)))))
double code(double x, double y) {
double tmp;
if (y <= -8.5e+119) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= -3.05e-56) {
tmp = y * x;
} else if (y <= 0.045) {
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 <= (-8.5d+119)) then
tmp = x
else if (y <= (-1.0d0)) then
tmp = 1.0d0 / y
else if (y <= (-3.05d-56)) then
tmp = y * x
else if (y <= 0.045d0) 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 <= -8.5e+119) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= -3.05e-56) {
tmp = y * x;
} else if (y <= 0.045) {
tmp = 1.0 - y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -8.5e+119: tmp = x elif y <= -1.0: tmp = 1.0 / y elif y <= -3.05e-56: tmp = y * x elif y <= 0.045: tmp = 1.0 - y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -8.5e+119) tmp = x; elseif (y <= -1.0) tmp = Float64(1.0 / y); elseif (y <= -3.05e-56) tmp = Float64(y * x); elseif (y <= 0.045) tmp = Float64(1.0 - y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -8.5e+119) tmp = x; elseif (y <= -1.0) tmp = 1.0 / y; elseif (y <= -3.05e-56) tmp = y * x; elseif (y <= 0.045) tmp = 1.0 - y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -8.5e+119], x, If[LessEqual[y, -1.0], N[(1.0 / y), $MachinePrecision], If[LessEqual[y, -3.05e-56], N[(y * x), $MachinePrecision], If[LessEqual[y, 0.045], N[(1.0 - y), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{+119}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{elif}\;y \leq -3.05 \cdot 10^{-56}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 0.045:\\
\;\;\;\;1 - y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -8.49999999999999997e119 or 0.044999999999999998 < y Initial program 28.5%
sub-neg28.5%
+-commutative28.5%
associate-/l*60.6%
distribute-neg-frac60.6%
*-lft-identity60.6%
associate-*l/60.6%
fma-def60.6%
associate-/l*60.6%
*-lft-identity60.6%
+-commutative60.6%
neg-sub060.6%
associate--r-60.6%
metadata-eval60.6%
+-commutative60.6%
Simplified60.6%
Taylor expanded in y around inf 77.5%
if -8.49999999999999997e119 < y < -1Initial program 45.7%
sub-neg45.7%
+-commutative45.7%
associate-/l*49.5%
distribute-neg-frac49.5%
*-lft-identity49.5%
associate-*l/49.5%
fma-def49.5%
associate-/l*49.5%
*-lft-identity49.5%
+-commutative49.5%
neg-sub049.5%
associate--r-49.5%
metadata-eval49.5%
+-commutative49.5%
Simplified49.5%
Taylor expanded in x around 0 6.7%
mul-1-neg6.7%
sub-neg6.7%
Simplified6.7%
Taylor expanded in y around inf 55.4%
if -1 < y < -3.0499999999999999e-56Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
associate-/l*99.3%
distribute-neg-frac99.3%
*-lft-identity99.3%
associate-*l/99.7%
fma-def99.7%
associate-/l*99.9%
*-lft-identity99.9%
+-commutative99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 73.5%
associate-/l*73.0%
Simplified73.0%
Taylor expanded in y around 0 66.3%
if -3.0499999999999999e-56 < y < 0.044999999999999998Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
associate-/l*99.9%
distribute-neg-frac99.9%
*-lft-identity99.9%
associate-*l/99.9%
fma-def99.9%
associate-/l*100.0%
*-lft-identity100.0%
+-commutative100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 72.5%
mul-1-neg72.5%
sub-neg72.5%
Simplified72.5%
Taylor expanded in y around 0 72.5%
neg-mul-172.5%
unsub-neg72.5%
Simplified72.5%
Final simplification72.6%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (- x (/ (+ x -1.0) y)) (+ 1.0 (- (* y x) y))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = x - ((x + -1.0) / y);
} else {
tmp = 1.0 + ((y * x) - y);
}
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 - ((x + (-1.0d0)) / y)
else
tmp = 1.0d0 + ((y * x) - y)
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 - ((x + -1.0) / y);
} else {
tmp = 1.0 + ((y * x) - y);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 1.0): tmp = x - ((x + -1.0) / y) else: tmp = 1.0 + ((y * x) - y) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.0)) tmp = Float64(x - Float64(Float64(x + -1.0) / y)); else tmp = Float64(1.0 + Float64(Float64(y * x) - y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.0) || ~((y <= 1.0))) tmp = x - ((x + -1.0) / y); else tmp = 1.0 + ((y * x) - y); 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[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(y * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;x - \frac{x + -1}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(y \cdot x - y\right)\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 30.8%
sub-neg30.8%
+-commutative30.8%
associate-/l*57.8%
distribute-neg-frac57.8%
*-lft-identity57.8%
associate-*l/57.8%
fma-def57.8%
associate-/l*57.9%
*-lft-identity57.9%
+-commutative57.9%
neg-sub057.9%
associate--r-57.9%
metadata-eval57.9%
+-commutative57.9%
Simplified57.9%
Taylor expanded in y around inf 97.7%
+-commutative97.7%
mul-1-neg97.7%
unsub-neg97.7%
sub-neg97.7%
metadata-eval97.7%
Simplified97.7%
if -1 < y < 1Initial program 100.0%
sub-neg100.0%
distribute-neg-frac100.0%
neg-mul-1100.0%
associate-*l/100.0%
metadata-eval100.0%
associate-*l/100.0%
associate-/r/100.0%
metadata-eval100.0%
distribute-neg-frac100.0%
cancel-sign-sub-inv100.0%
associate-/r/99.9%
associate-/r*99.9%
neg-mul-199.9%
associate-/r/100.0%
distribute-rgt-neg-in100.0%
associate-/r/99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
associate-/r/100.0%
Simplified99.9%
Taylor expanded in y around 0 97.9%
sub-neg97.9%
distribute-lft-in97.9%
*-rgt-identity97.9%
distribute-rgt-neg-out97.9%
unsub-neg97.9%
Simplified97.9%
Final simplification97.8%
(FPCore (x y) :precision binary64 (if (<= y -1.0) (- (+ x (/ 1.0 y)) (/ x y)) (if (<= y 1.0) (+ 1.0 (- (* y x) y)) (- x (/ (+ x -1.0) y)))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = (x + (1.0 / y)) - (x / y);
} else if (y <= 1.0) {
tmp = 1.0 + ((y * x) - y);
} else {
tmp = x - ((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 <= (-1.0d0)) then
tmp = (x + (1.0d0 / y)) - (x / y)
else if (y <= 1.0d0) then
tmp = 1.0d0 + ((y * x) - y)
else
tmp = x - ((x + (-1.0d0)) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = (x + (1.0 / y)) - (x / y);
} else if (y <= 1.0) {
tmp = 1.0 + ((y * x) - y);
} else {
tmp = x - ((x + -1.0) / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = (x + (1.0 / y)) - (x / y) elif y <= 1.0: tmp = 1.0 + ((y * x) - y) else: tmp = x - ((x + -1.0) / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = Float64(Float64(x + Float64(1.0 / y)) - Float64(x / y)); elseif (y <= 1.0) tmp = Float64(1.0 + Float64(Float64(y * x) - y)); else tmp = Float64(x - Float64(Float64(x + -1.0) / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = (x + (1.0 / y)) - (x / y); elseif (y <= 1.0) tmp = 1.0 + ((y * x) - y); else tmp = x - ((x + -1.0) / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], N[(N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision] - N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(1.0 + N[(N[(y * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;\left(x + \frac{1}{y}\right) - \frac{x}{y}\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;1 + \left(y \cdot x - y\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{x + -1}{y}\\
\end{array}
\end{array}
if y < -1Initial program 28.6%
sub-neg28.6%
distribute-neg-frac28.6%
neg-mul-128.6%
associate-*l/28.0%
metadata-eval28.0%
associate-*l/28.0%
associate-/r/28.0%
metadata-eval28.0%
distribute-neg-frac28.0%
cancel-sign-sub-inv28.0%
associate-/r/28.5%
associate-/r*28.5%
neg-mul-128.5%
associate-/r/28.0%
distribute-rgt-neg-in28.0%
associate-/r/28.5%
distribute-neg-frac28.5%
metadata-eval28.5%
associate-/r/28.0%
Simplified53.7%
Taylor expanded in y around inf 97.7%
if -1 < y < 1Initial program 100.0%
sub-neg100.0%
distribute-neg-frac100.0%
neg-mul-1100.0%
associate-*l/100.0%
metadata-eval100.0%
associate-*l/100.0%
associate-/r/100.0%
metadata-eval100.0%
distribute-neg-frac100.0%
cancel-sign-sub-inv100.0%
associate-/r/99.9%
associate-/r*99.9%
neg-mul-199.9%
associate-/r/100.0%
distribute-rgt-neg-in100.0%
associate-/r/99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
associate-/r/100.0%
Simplified99.9%
Taylor expanded in y around 0 97.9%
sub-neg97.9%
distribute-lft-in97.9%
*-rgt-identity97.9%
distribute-rgt-neg-out97.9%
unsub-neg97.9%
Simplified97.9%
if 1 < y Initial program 33.2%
sub-neg33.2%
+-commutative33.2%
associate-/l*61.5%
distribute-neg-frac61.5%
*-lft-identity61.5%
associate-*l/61.5%
fma-def61.5%
associate-/l*61.6%
*-lft-identity61.6%
+-commutative61.6%
neg-sub061.6%
associate--r-61.6%
metadata-eval61.6%
+-commutative61.6%
Simplified61.6%
Taylor expanded in y around inf 97.6%
+-commutative97.6%
mul-1-neg97.6%
unsub-neg97.6%
sub-neg97.6%
metadata-eval97.6%
Simplified97.6%
Final simplification97.8%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y -1.22e-52) (* y x) (if (<= y 0.039) (- 1.0 y) x))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= -1.22e-52) {
tmp = y * x;
} else if (y <= 0.039) {
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 <= (-1.22d-52)) then
tmp = y * x
else if (y <= 0.039d0) 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 <= -1.22e-52) {
tmp = y * x;
} else if (y <= 0.039) {
tmp = 1.0 - y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= -1.22e-52: tmp = y * x elif y <= 0.039: tmp = 1.0 - y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= -1.22e-52) tmp = Float64(y * x); elseif (y <= 0.039) 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 <= -1.22e-52) tmp = y * x; elseif (y <= 0.039) tmp = 1.0 - y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, -1.22e-52], N[(y * x), $MachinePrecision], If[LessEqual[y, 0.039], N[(1.0 - y), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1.22 \cdot 10^{-52}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 0.039:\\
\;\;\;\;1 - y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 0.0389999999999999999 < y Initial program 31.9%
sub-neg31.9%
+-commutative31.9%
associate-/l*58.5%
distribute-neg-frac58.5%
*-lft-identity58.5%
associate-*l/58.4%
fma-def58.4%
associate-/l*58.5%
*-lft-identity58.5%
+-commutative58.5%
neg-sub058.5%
associate--r-58.5%
metadata-eval58.5%
+-commutative58.5%
Simplified58.5%
Taylor expanded in y around inf 70.2%
if -1 < y < -1.22e-52Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
associate-/l*99.3%
distribute-neg-frac99.3%
*-lft-identity99.3%
associate-*l/99.7%
fma-def99.7%
associate-/l*99.9%
*-lft-identity99.9%
+-commutative99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 73.5%
associate-/l*73.0%
Simplified73.0%
Taylor expanded in y around 0 66.3%
if -1.22e-52 < y < 0.0389999999999999999Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
associate-/l*99.9%
distribute-neg-frac99.9%
*-lft-identity99.9%
associate-*l/99.9%
fma-def99.9%
associate-/l*100.0%
*-lft-identity100.0%
+-commutative100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 72.5%
mul-1-neg72.5%
sub-neg72.5%
Simplified72.5%
Taylor expanded in y around 0 72.5%
neg-mul-172.5%
unsub-neg72.5%
Simplified72.5%
Final simplification71.0%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y -8.5e-58) (* y x) (if (<= y 0.0145) 1.0 x))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= -8.5e-58) {
tmp = y * x;
} else if (y <= 0.0145) {
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 <= (-8.5d-58)) then
tmp = y * x
else if (y <= 0.0145d0) 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 <= -8.5e-58) {
tmp = y * x;
} else if (y <= 0.0145) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= -8.5e-58: tmp = y * x elif y <= 0.0145: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= -8.5e-58) tmp = Float64(y * x); elseif (y <= 0.0145) 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 <= -8.5e-58) tmp = y * x; elseif (y <= 0.0145) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, -8.5e-58], N[(y * x), $MachinePrecision], If[LessEqual[y, 0.0145], 1.0, x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -8.5 \cdot 10^{-58}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 0.0145:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 0.0145000000000000007 < y Initial program 31.9%
sub-neg31.9%
+-commutative31.9%
associate-/l*58.5%
distribute-neg-frac58.5%
*-lft-identity58.5%
associate-*l/58.4%
fma-def58.4%
associate-/l*58.5%
*-lft-identity58.5%
+-commutative58.5%
neg-sub058.5%
associate--r-58.5%
metadata-eval58.5%
+-commutative58.5%
Simplified58.5%
Taylor expanded in y around inf 70.2%
if -1 < y < -8.5000000000000004e-58Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
associate-/l*99.3%
distribute-neg-frac99.3%
*-lft-identity99.3%
associate-*l/99.7%
fma-def99.7%
associate-/l*99.9%
*-lft-identity99.9%
+-commutative99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 73.5%
associate-/l*73.0%
Simplified73.0%
Taylor expanded in y around 0 66.3%
if -8.5000000000000004e-58 < y < 0.0145000000000000007Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
associate-/l*99.9%
distribute-neg-frac99.9%
*-lft-identity99.9%
associate-*l/99.9%
fma-def99.9%
associate-/l*100.0%
*-lft-identity100.0%
+-commutative100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 72.2%
Final simplification70.9%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 0.026) 1.0 x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 0.026) {
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 <= 0.026d0) 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 <= 0.026) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 0.026: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 0.026) 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 <= 0.026) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 0.026], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 0.026:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 0.0259999999999999988 < y Initial program 31.9%
sub-neg31.9%
+-commutative31.9%
associate-/l*58.5%
distribute-neg-frac58.5%
*-lft-identity58.5%
associate-*l/58.4%
fma-def58.4%
associate-/l*58.5%
*-lft-identity58.5%
+-commutative58.5%
neg-sub058.5%
associate--r-58.5%
metadata-eval58.5%
+-commutative58.5%
Simplified58.5%
Taylor expanded in y around inf 70.2%
if -1 < y < 0.0259999999999999988Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
associate-/l*99.8%
distribute-neg-frac99.8%
*-lft-identity99.8%
associate-*l/99.9%
fma-def99.9%
associate-/l*100.0%
*-lft-identity100.0%
+-commutative100.0%
neg-sub0100.0%
associate--r-100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 67.6%
Final simplification68.9%
(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 65.4%
sub-neg65.4%
+-commutative65.4%
associate-/l*78.8%
distribute-neg-frac78.8%
*-lft-identity78.8%
associate-*l/78.9%
fma-def78.9%
associate-/l*78.9%
*-lft-identity78.9%
+-commutative78.9%
neg-sub078.9%
associate--r-78.9%
metadata-eval78.9%
+-commutative78.9%
Simplified78.9%
Taylor expanded in y around 0 35.3%
Final simplification35.3%
(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 2023221
(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))))