
(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 13 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 (/ (- 1.0 x) y)) (t_1 (/ (+ x -1.0) (pow y 2.0))))
(if (<= y -290000.0)
(+ (+ x t_0) t_1)
(if (<= y 11800.0)
(fma (/ (+ x -1.0) (+ y 1.0)) y 1.0)
(+ x (+ t_1 (+ (/ (- 1.0 x) (pow y 3.0)) t_0)))))))
double code(double x, double y) {
double t_0 = (1.0 - x) / y;
double t_1 = (x + -1.0) / pow(y, 2.0);
double tmp;
if (y <= -290000.0) {
tmp = (x + t_0) + t_1;
} else if (y <= 11800.0) {
tmp = fma(((x + -1.0) / (y + 1.0)), y, 1.0);
} else {
tmp = x + (t_1 + (((1.0 - x) / pow(y, 3.0)) + t_0));
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(1.0 - x) / y) t_1 = Float64(Float64(x + -1.0) / (y ^ 2.0)) tmp = 0.0 if (y <= -290000.0) tmp = Float64(Float64(x + t_0) + t_1); elseif (y <= 11800.0) tmp = fma(Float64(Float64(x + -1.0) / Float64(y + 1.0)), y, 1.0); else tmp = Float64(x + Float64(t_1 + Float64(Float64(Float64(1.0 - x) / (y ^ 3.0)) + t_0))); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + -1.0), $MachinePrecision] / N[Power[y, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -290000.0], N[(N[(x + t$95$0), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[y, 11800.0], N[(N[(N[(x + -1.0), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] * y + 1.0), $MachinePrecision], N[(x + N[(t$95$1 + N[(N[(N[(1.0 - x), $MachinePrecision] / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1 - x}{y}\\
t_1 := \frac{x + -1}{{y}^{2}}\\
\mathbf{if}\;y \leq -290000:\\
\;\;\;\;\left(x + t_0\right) + t_1\\
\mathbf{elif}\;y \leq 11800:\\
\;\;\;\;\mathsf{fma}\left(\frac{x + -1}{y + 1}, y, 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(t_1 + \left(\frac{1 - x}{{y}^{3}} + t_0\right)\right)\\
\end{array}
\end{array}
if y < -2.9e5Initial program 31.8%
associate-*l/47.4%
+-commutative47.4%
Simplified47.4%
Taylor expanded in y around -inf 100.0%
associate-+r+100.0%
associate--l+100.0%
mul-1-neg100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
div-sub100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
if -2.9e5 < y < 11800Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
associate-*l/99.9%
distribute-lft-neg-in99.9%
fma-def99.9%
distribute-frac-neg99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
if 11800 < y Initial program 34.0%
associate-*l/60.0%
+-commutative60.0%
Simplified60.0%
Taylor expanded in y around -inf 99.7%
associate--l+99.7%
associate-+r+99.7%
associate--l+99.7%
Simplified99.7%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (or (<= y -23000000.0) (not (<= y 320000.0))) (+ (+ x (/ (- 1.0 x) y)) (/ (+ x -1.0) (pow y 2.0))) (+ 1.0 (/ (* y (+ x -1.0)) (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -23000000.0) || !(y <= 320000.0)) {
tmp = (x + ((1.0 - x) / y)) + ((x + -1.0) / pow(y, 2.0));
} 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 <= (-23000000.0d0)) .or. (.not. (y <= 320000.0d0))) then
tmp = (x + ((1.0d0 - x) / y)) + ((x + (-1.0d0)) / (y ** 2.0d0))
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 <= -23000000.0) || !(y <= 320000.0)) {
tmp = (x + ((1.0 - x) / y)) + ((x + -1.0) / Math.pow(y, 2.0));
} else {
tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -23000000.0) or not (y <= 320000.0): tmp = (x + ((1.0 - x) / y)) + ((x + -1.0) / math.pow(y, 2.0)) else: tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -23000000.0) || !(y <= 320000.0)) tmp = Float64(Float64(x + Float64(Float64(1.0 - x) / y)) + Float64(Float64(x + -1.0) / (y ^ 2.0))); 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 <= -23000000.0) || ~((y <= 320000.0))) tmp = (x + ((1.0 - x) / y)) + ((x + -1.0) / (y ^ 2.0)); else tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -23000000.0], N[Not[LessEqual[y, 320000.0]], $MachinePrecision]], N[(N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + N[(N[(x + -1.0), $MachinePrecision] / N[Power[y, 2.0], $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 -23000000 \lor \neg \left(y \leq 320000\right):\\
\;\;\;\;\left(x + \frac{1 - x}{y}\right) + \frac{x + -1}{{y}^{2}}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y \cdot \left(x + -1\right)}{y + 1}\\
\end{array}
\end{array}
if y < -2.3e7 or 3.2e5 < y Initial program 31.3%
associate-*l/52.5%
+-commutative52.5%
Simplified52.5%
Taylor expanded in y around -inf 99.9%
associate-+r+99.9%
associate--l+99.9%
mul-1-neg99.9%
unsub-neg99.9%
sub-neg99.9%
metadata-eval99.9%
div-sub99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
if -2.3e7 < y < 3.2e5Initial program 99.8%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(if (<= y -90.0)
x
(if (<= y -4e-104)
(* y x)
(if (<= y 6.2e-123)
1.0
(if (<= y 1.86e-50)
(* y x)
(if (<= y 5.5e-5)
(- 1.0 y)
(if (<= y 6.1e+94) x (if (<= y 9.2e+125) (/ 1.0 y) x))))))))
double code(double x, double y) {
double tmp;
if (y <= -90.0) {
tmp = x;
} else if (y <= -4e-104) {
tmp = y * x;
} else if (y <= 6.2e-123) {
tmp = 1.0;
} else if (y <= 1.86e-50) {
tmp = y * x;
} else if (y <= 5.5e-5) {
tmp = 1.0 - y;
} else if (y <= 6.1e+94) {
tmp = x;
} else if (y <= 9.2e+125) {
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 <= (-90.0d0)) then
tmp = x
else if (y <= (-4d-104)) then
tmp = y * x
else if (y <= 6.2d-123) then
tmp = 1.0d0
else if (y <= 1.86d-50) then
tmp = y * x
else if (y <= 5.5d-5) then
tmp = 1.0d0 - y
else if (y <= 6.1d+94) then
tmp = x
else if (y <= 9.2d+125) 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 <= -90.0) {
tmp = x;
} else if (y <= -4e-104) {
tmp = y * x;
} else if (y <= 6.2e-123) {
tmp = 1.0;
} else if (y <= 1.86e-50) {
tmp = y * x;
} else if (y <= 5.5e-5) {
tmp = 1.0 - y;
} else if (y <= 6.1e+94) {
tmp = x;
} else if (y <= 9.2e+125) {
tmp = 1.0 / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -90.0: tmp = x elif y <= -4e-104: tmp = y * x elif y <= 6.2e-123: tmp = 1.0 elif y <= 1.86e-50: tmp = y * x elif y <= 5.5e-5: tmp = 1.0 - y elif y <= 6.1e+94: tmp = x elif y <= 9.2e+125: tmp = 1.0 / y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -90.0) tmp = x; elseif (y <= -4e-104) tmp = Float64(y * x); elseif (y <= 6.2e-123) tmp = 1.0; elseif (y <= 1.86e-50) tmp = Float64(y * x); elseif (y <= 5.5e-5) tmp = Float64(1.0 - y); elseif (y <= 6.1e+94) tmp = x; elseif (y <= 9.2e+125) tmp = Float64(1.0 / y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -90.0) tmp = x; elseif (y <= -4e-104) tmp = y * x; elseif (y <= 6.2e-123) tmp = 1.0; elseif (y <= 1.86e-50) tmp = y * x; elseif (y <= 5.5e-5) tmp = 1.0 - y; elseif (y <= 6.1e+94) tmp = x; elseif (y <= 9.2e+125) tmp = 1.0 / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -90.0], x, If[LessEqual[y, -4e-104], N[(y * x), $MachinePrecision], If[LessEqual[y, 6.2e-123], 1.0, If[LessEqual[y, 1.86e-50], N[(y * x), $MachinePrecision], If[LessEqual[y, 5.5e-5], N[(1.0 - y), $MachinePrecision], If[LessEqual[y, 6.1e+94], x, If[LessEqual[y, 9.2e+125], N[(1.0 / y), $MachinePrecision], x]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -90:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-104}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{-123}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.86 \cdot 10^{-50}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-5}:\\
\;\;\;\;1 - y\\
\mathbf{elif}\;y \leq 6.1 \cdot 10^{+94}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 9.2 \cdot 10^{+125}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -90 or 5.5000000000000002e-5 < y < 6.10000000000000035e94 or 9.20000000000000051e125 < y Initial program 35.6%
associate-*l/57.0%
+-commutative57.0%
Simplified57.0%
Taylor expanded in y around inf 70.5%
if -90 < y < -3.99999999999999971e-104 or 6.19999999999999996e-123 < y < 1.86000000000000007e-50Initial program 99.8%
associate-*l/99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 61.1%
/-rgt-identity61.1%
associate-/r/60.9%
associate-/r*60.9%
+-commutative60.9%
distribute-lft-in60.9%
lft-mult-inverse60.9%
*-rgt-identity60.9%
Simplified60.9%
Taylor expanded in y around 0 58.5%
*-commutative58.5%
Simplified58.5%
if -3.99999999999999971e-104 < y < 6.19999999999999996e-123Initial program 100.0%
associate-*l/100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 90.6%
if 1.86000000000000007e-50 < y < 5.5000000000000002e-5Initial program 100.0%
associate-*l/100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 68.9%
Taylor expanded in y around 0 68.9%
neg-mul-168.9%
unsub-neg68.9%
Simplified68.9%
if 6.10000000000000035e94 < y < 9.20000000000000051e125Initial program 16.1%
associate-*l/16.3%
+-commutative16.3%
Simplified16.3%
Taylor expanded in y around -inf 99.6%
mul-1-neg99.6%
unsub-neg99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 74.9%
Final simplification73.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- x (/ x y))))
(if (<= y -90.0)
t_0
(if (<= y -4e-104)
(* y x)
(if (<= y 2.75e-123)
1.0
(if (<= y 2.1e-50)
(* y x)
(if (<= y 1.0)
(- 1.0 y)
(if (<= y 1.8e+97) t_0 (if (<= y 9e+125) (/ 1.0 y) x)))))))))
double code(double x, double y) {
double t_0 = x - (x / y);
double tmp;
if (y <= -90.0) {
tmp = t_0;
} else if (y <= -4e-104) {
tmp = y * x;
} else if (y <= 2.75e-123) {
tmp = 1.0;
} else if (y <= 2.1e-50) {
tmp = y * x;
} else if (y <= 1.0) {
tmp = 1.0 - y;
} else if (y <= 1.8e+97) {
tmp = t_0;
} else if (y <= 9e+125) {
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) :: t_0
real(8) :: tmp
t_0 = x - (x / y)
if (y <= (-90.0d0)) then
tmp = t_0
else if (y <= (-4d-104)) then
tmp = y * x
else if (y <= 2.75d-123) then
tmp = 1.0d0
else if (y <= 2.1d-50) then
tmp = y * x
else if (y <= 1.0d0) then
tmp = 1.0d0 - y
else if (y <= 1.8d+97) then
tmp = t_0
else if (y <= 9d+125) then
tmp = 1.0d0 / y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x - (x / y);
double tmp;
if (y <= -90.0) {
tmp = t_0;
} else if (y <= -4e-104) {
tmp = y * x;
} else if (y <= 2.75e-123) {
tmp = 1.0;
} else if (y <= 2.1e-50) {
tmp = y * x;
} else if (y <= 1.0) {
tmp = 1.0 - y;
} else if (y <= 1.8e+97) {
tmp = t_0;
} else if (y <= 9e+125) {
tmp = 1.0 / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): t_0 = x - (x / y) tmp = 0 if y <= -90.0: tmp = t_0 elif y <= -4e-104: tmp = y * x elif y <= 2.75e-123: tmp = 1.0 elif y <= 2.1e-50: tmp = y * x elif y <= 1.0: tmp = 1.0 - y elif y <= 1.8e+97: tmp = t_0 elif y <= 9e+125: tmp = 1.0 / y else: tmp = x return tmp
function code(x, y) t_0 = Float64(x - Float64(x / y)) tmp = 0.0 if (y <= -90.0) tmp = t_0; elseif (y <= -4e-104) tmp = Float64(y * x); elseif (y <= 2.75e-123) tmp = 1.0; elseif (y <= 2.1e-50) tmp = Float64(y * x); elseif (y <= 1.0) tmp = Float64(1.0 - y); elseif (y <= 1.8e+97) tmp = t_0; elseif (y <= 9e+125) tmp = Float64(1.0 / y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) t_0 = x - (x / y); tmp = 0.0; if (y <= -90.0) tmp = t_0; elseif (y <= -4e-104) tmp = y * x; elseif (y <= 2.75e-123) tmp = 1.0; elseif (y <= 2.1e-50) tmp = y * x; elseif (y <= 1.0) tmp = 1.0 - y; elseif (y <= 1.8e+97) tmp = t_0; elseif (y <= 9e+125) tmp = 1.0 / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x - N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -90.0], t$95$0, If[LessEqual[y, -4e-104], N[(y * x), $MachinePrecision], If[LessEqual[y, 2.75e-123], 1.0, If[LessEqual[y, 2.1e-50], N[(y * x), $MachinePrecision], If[LessEqual[y, 1.0], N[(1.0 - y), $MachinePrecision], If[LessEqual[y, 1.8e+97], t$95$0, If[LessEqual[y, 9e+125], N[(1.0 / y), $MachinePrecision], x]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x - \frac{x}{y}\\
\mathbf{if}\;y \leq -90:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-104}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 2.75 \cdot 10^{-123}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{-50}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;1 - y\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+97}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+125}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -90 or 1 < y < 1.79999999999999983e97Initial program 38.2%
associate-*l/52.8%
+-commutative52.8%
Simplified52.8%
Taylor expanded in x around inf 56.8%
/-rgt-identity56.8%
associate-/r/56.6%
associate-/r*71.4%
+-commutative71.4%
distribute-lft-in71.5%
lft-mult-inverse71.6%
*-rgt-identity71.6%
Simplified71.6%
Taylor expanded in y around inf 70.4%
mul-1-neg70.4%
unsub-neg70.4%
Simplified70.4%
if -90 < y < -3.99999999999999971e-104 or 2.75e-123 < y < 2.1000000000000001e-50Initial program 99.8%
associate-*l/99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 61.1%
/-rgt-identity61.1%
associate-/r/60.9%
associate-/r*60.9%
+-commutative60.9%
distribute-lft-in60.9%
lft-mult-inverse60.9%
*-rgt-identity60.9%
Simplified60.9%
Taylor expanded in y around 0 58.5%
*-commutative58.5%
Simplified58.5%
if -3.99999999999999971e-104 < y < 2.75e-123Initial program 100.0%
associate-*l/100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 90.6%
if 2.1000000000000001e-50 < y < 1Initial program 99.6%
associate-*l/99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around 0 57.3%
Taylor expanded in y around 0 57.3%
neg-mul-157.3%
unsub-neg57.3%
Simplified57.3%
if 1.79999999999999983e97 < y < 9.0000000000000001e125Initial program 16.1%
associate-*l/16.3%
+-commutative16.3%
Simplified16.3%
Taylor expanded in y around -inf 99.6%
mul-1-neg99.6%
unsub-neg99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 74.9%
if 9.0000000000000001e125 < y Initial program 24.1%
associate-*l/66.3%
+-commutative66.3%
Simplified66.3%
Taylor expanded in y around inf 78.8%
Final simplification74.3%
(FPCore (x y) :precision binary64 (if (or (<= y -110000000.0) (not (<= y 230000000.0))) (+ x (/ (- 1.0 x) y)) (+ 1.0 (* y (/ (+ x -1.0) (+ y 1.0))))))
double code(double x, double y) {
double tmp;
if ((y <= -110000000.0) || !(y <= 230000000.0)) {
tmp = x + ((1.0 - x) / 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 <= (-110000000.0d0)) .or. (.not. (y <= 230000000.0d0))) then
tmp = x + ((1.0d0 - x) / 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 <= -110000000.0) || !(y <= 230000000.0)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -110000000.0) or not (y <= 230000000.0): tmp = x + ((1.0 - x) / y) else: tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0))) return tmp
function code(x, y) tmp = 0.0 if ((y <= -110000000.0) || !(y <= 230000000.0)) tmp = Float64(x + Float64(Float64(1.0 - x) / 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 <= -110000000.0) || ~((y <= 230000000.0))) tmp = x + ((1.0 - x) / y); else tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -110000000.0], N[Not[LessEqual[y, 230000000.0]], $MachinePrecision]], N[(x + N[(N[(1.0 - x), $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 -110000000 \lor \neg \left(y \leq 230000000\right):\\
\;\;\;\;x + \frac{1 - x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\
\end{array}
\end{array}
if y < -1.1e8 or 2.3e8 < y Initial program 30.5%
associate-*l/51.9%
+-commutative51.9%
Simplified51.9%
Taylor expanded in y around -inf 99.5%
mul-1-neg99.5%
unsub-neg99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
if -1.1e8 < y < 2.3e8Initial program 99.6%
associate-*l/99.5%
+-commutative99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y) :precision binary64 (if (or (<= y -180000000.0) (not (<= y 155000000.0))) (+ x (/ (- 1.0 x) y)) (+ 1.0 (/ (* y (+ x -1.0)) (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -180000000.0) || !(y <= 155000000.0)) {
tmp = x + ((1.0 - x) / 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 <= 155000000.0d0))) then
tmp = x + ((1.0d0 - x) / 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 <= 155000000.0)) {
tmp = x + ((1.0 - x) / 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 <= 155000000.0): tmp = x + ((1.0 - x) / 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 <= 155000000.0)) tmp = Float64(x + Float64(Float64(1.0 - x) / 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 <= -180000000.0) || ~((y <= 155000000.0))) tmp = x + ((1.0 - x) / 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, 155000000.0]], $MachinePrecision]], N[(x + N[(N[(1.0 - x), $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 -180000000 \lor \neg \left(y \leq 155000000\right):\\
\;\;\;\;x + \frac{1 - x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y \cdot \left(x + -1\right)}{y + 1}\\
\end{array}
\end{array}
if y < -1.8e8 or 1.55e8 < y Initial program 30.5%
associate-*l/51.9%
+-commutative51.9%
Simplified51.9%
Taylor expanded in y around -inf 99.5%
mul-1-neg99.5%
unsub-neg99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
if -1.8e8 < y < 1.55e8Initial program 99.6%
Final simplification99.6%
(FPCore (x y)
:precision binary64
(if (<= y -90.0)
x
(if (<= y -5.8e-105)
(* y x)
(if (<= y 6.2e-123)
1.0
(if (<= y 1.15e-50) (* y x) (if (<= y 5.5e-5) (- 1.0 y) x))))))
double code(double x, double y) {
double tmp;
if (y <= -90.0) {
tmp = x;
} else if (y <= -5.8e-105) {
tmp = y * x;
} else if (y <= 6.2e-123) {
tmp = 1.0;
} else if (y <= 1.15e-50) {
tmp = y * x;
} else if (y <= 5.5e-5) {
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 <= (-90.0d0)) then
tmp = x
else if (y <= (-5.8d-105)) then
tmp = y * x
else if (y <= 6.2d-123) then
tmp = 1.0d0
else if (y <= 1.15d-50) then
tmp = y * x
else if (y <= 5.5d-5) 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 <= -90.0) {
tmp = x;
} else if (y <= -5.8e-105) {
tmp = y * x;
} else if (y <= 6.2e-123) {
tmp = 1.0;
} else if (y <= 1.15e-50) {
tmp = y * x;
} else if (y <= 5.5e-5) {
tmp = 1.0 - y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -90.0: tmp = x elif y <= -5.8e-105: tmp = y * x elif y <= 6.2e-123: tmp = 1.0 elif y <= 1.15e-50: tmp = y * x elif y <= 5.5e-5: tmp = 1.0 - y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -90.0) tmp = x; elseif (y <= -5.8e-105) tmp = Float64(y * x); elseif (y <= 6.2e-123) tmp = 1.0; elseif (y <= 1.15e-50) tmp = Float64(y * x); elseif (y <= 5.5e-5) tmp = Float64(1.0 - y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -90.0) tmp = x; elseif (y <= -5.8e-105) tmp = y * x; elseif (y <= 6.2e-123) tmp = 1.0; elseif (y <= 1.15e-50) tmp = y * x; elseif (y <= 5.5e-5) tmp = 1.0 - y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -90.0], x, If[LessEqual[y, -5.8e-105], N[(y * x), $MachinePrecision], If[LessEqual[y, 6.2e-123], 1.0, If[LessEqual[y, 1.15e-50], N[(y * x), $MachinePrecision], If[LessEqual[y, 5.5e-5], N[(1.0 - y), $MachinePrecision], x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -90:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-105}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{-123}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-50}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-5}:\\
\;\;\;\;1 - y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -90 or 5.5000000000000002e-5 < y Initial program 34.4%
associate-*l/54.5%
+-commutative54.5%
Simplified54.5%
Taylor expanded in y around inf 67.2%
if -90 < y < -5.80000000000000007e-105 or 6.19999999999999996e-123 < y < 1.1500000000000001e-50Initial program 99.8%
associate-*l/99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 61.1%
/-rgt-identity61.1%
associate-/r/60.9%
associate-/r*60.9%
+-commutative60.9%
distribute-lft-in60.9%
lft-mult-inverse60.9%
*-rgt-identity60.9%
Simplified60.9%
Taylor expanded in y around 0 58.5%
*-commutative58.5%
Simplified58.5%
if -5.80000000000000007e-105 < y < 6.19999999999999996e-123Initial program 100.0%
associate-*l/100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 90.6%
if 1.1500000000000001e-50 < y < 5.5000000000000002e-5Initial program 100.0%
associate-*l/100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 68.9%
Taylor expanded in y around 0 68.9%
neg-mul-168.9%
unsub-neg68.9%
Simplified68.9%
Final simplification72.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* x (/ y (+ y 1.0)))))
(if (<= y -4e-104)
t_0
(if (<= y 6.2e-123)
1.0
(if (<= y 2.85e+97) t_0 (if (<= y 9.5e+125) (/ 1.0 y) x))))))
double code(double x, double y) {
double t_0 = x * (y / (y + 1.0));
double tmp;
if (y <= -4e-104) {
tmp = t_0;
} else if (y <= 6.2e-123) {
tmp = 1.0;
} else if (y <= 2.85e+97) {
tmp = t_0;
} else if (y <= 9.5e+125) {
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) :: t_0
real(8) :: tmp
t_0 = x * (y / (y + 1.0d0))
if (y <= (-4d-104)) then
tmp = t_0
else if (y <= 6.2d-123) then
tmp = 1.0d0
else if (y <= 2.85d+97) then
tmp = t_0
else if (y <= 9.5d+125) then
tmp = 1.0d0 / y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x * (y / (y + 1.0));
double tmp;
if (y <= -4e-104) {
tmp = t_0;
} else if (y <= 6.2e-123) {
tmp = 1.0;
} else if (y <= 2.85e+97) {
tmp = t_0;
} else if (y <= 9.5e+125) {
tmp = 1.0 / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): t_0 = x * (y / (y + 1.0)) tmp = 0 if y <= -4e-104: tmp = t_0 elif y <= 6.2e-123: tmp = 1.0 elif y <= 2.85e+97: tmp = t_0 elif y <= 9.5e+125: tmp = 1.0 / y else: tmp = x return tmp
function code(x, y) t_0 = Float64(x * Float64(y / Float64(y + 1.0))) tmp = 0.0 if (y <= -4e-104) tmp = t_0; elseif (y <= 6.2e-123) tmp = 1.0; elseif (y <= 2.85e+97) tmp = t_0; elseif (y <= 9.5e+125) tmp = Float64(1.0 / y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) t_0 = x * (y / (y + 1.0)); tmp = 0.0; if (y <= -4e-104) tmp = t_0; elseif (y <= 6.2e-123) tmp = 1.0; elseif (y <= 2.85e+97) tmp = t_0; elseif (y <= 9.5e+125) tmp = 1.0 / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4e-104], t$95$0, If[LessEqual[y, 6.2e-123], 1.0, If[LessEqual[y, 2.85e+97], t$95$0, If[LessEqual[y, 9.5e+125], N[(1.0 / y), $MachinePrecision], x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{y}{y + 1}\\
\mathbf{if}\;y \leq -4 \cdot 10^{-104}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{-123}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 2.85 \cdot 10^{+97}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{+125}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -3.99999999999999971e-104 or 6.19999999999999996e-123 < y < 2.8500000000000001e97Initial program 62.5%
associate-*l/71.3%
+-commutative71.3%
Simplified71.3%
Taylor expanded in x around inf 56.9%
associate-*r/65.9%
*-commutative65.9%
Simplified65.9%
if -3.99999999999999971e-104 < y < 6.19999999999999996e-123Initial program 100.0%
associate-*l/100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 90.6%
if 2.8500000000000001e97 < y < 9.50000000000000041e125Initial program 16.1%
associate-*l/16.3%
+-commutative16.3%
Simplified16.3%
Taylor expanded in y around -inf 99.6%
mul-1-neg99.6%
unsub-neg99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 74.9%
if 9.50000000000000041e125 < y Initial program 24.1%
associate-*l/66.3%
+-commutative66.3%
Simplified66.3%
Taylor expanded in y around inf 78.8%
Final simplification74.5%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* x (/ y (+ y 1.0)))))
(if (<= y -4.2e-5)
t_0
(if (<= y 7.8e-6)
(+ 1.0 (* y (+ x -1.0)))
(if (<= y 2.75e+97) t_0 (if (<= y 9e+125) (/ 1.0 y) x))))))
double code(double x, double y) {
double t_0 = x * (y / (y + 1.0));
double tmp;
if (y <= -4.2e-5) {
tmp = t_0;
} else if (y <= 7.8e-6) {
tmp = 1.0 + (y * (x + -1.0));
} else if (y <= 2.75e+97) {
tmp = t_0;
} else if (y <= 9e+125) {
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) :: t_0
real(8) :: tmp
t_0 = x * (y / (y + 1.0d0))
if (y <= (-4.2d-5)) then
tmp = t_0
else if (y <= 7.8d-6) then
tmp = 1.0d0 + (y * (x + (-1.0d0)))
else if (y <= 2.75d+97) then
tmp = t_0
else if (y <= 9d+125) then
tmp = 1.0d0 / y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x * (y / (y + 1.0));
double tmp;
if (y <= -4.2e-5) {
tmp = t_0;
} else if (y <= 7.8e-6) {
tmp = 1.0 + (y * (x + -1.0));
} else if (y <= 2.75e+97) {
tmp = t_0;
} else if (y <= 9e+125) {
tmp = 1.0 / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): t_0 = x * (y / (y + 1.0)) tmp = 0 if y <= -4.2e-5: tmp = t_0 elif y <= 7.8e-6: tmp = 1.0 + (y * (x + -1.0)) elif y <= 2.75e+97: tmp = t_0 elif y <= 9e+125: tmp = 1.0 / y else: tmp = x return tmp
function code(x, y) t_0 = Float64(x * Float64(y / Float64(y + 1.0))) tmp = 0.0 if (y <= -4.2e-5) tmp = t_0; elseif (y <= 7.8e-6) tmp = Float64(1.0 + Float64(y * Float64(x + -1.0))); elseif (y <= 2.75e+97) tmp = t_0; elseif (y <= 9e+125) tmp = Float64(1.0 / y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) t_0 = x * (y / (y + 1.0)); tmp = 0.0; if (y <= -4.2e-5) tmp = t_0; elseif (y <= 7.8e-6) tmp = 1.0 + (y * (x + -1.0)); elseif (y <= 2.75e+97) tmp = t_0; elseif (y <= 9e+125) tmp = 1.0 / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.2e-5], t$95$0, If[LessEqual[y, 7.8e-6], N[(1.0 + N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.75e+97], t$95$0, If[LessEqual[y, 9e+125], N[(1.0 / y), $MachinePrecision], x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{y}{y + 1}\\
\mathbf{if}\;y \leq -4.2 \cdot 10^{-5}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{-6}:\\
\;\;\;\;1 + y \cdot \left(x + -1\right)\\
\mathbf{elif}\;y \leq 2.75 \cdot 10^{+97}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+125}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -4.19999999999999977e-5 or 7.7999999999999999e-6 < y < 2.75000000000000011e97Initial program 41.3%
associate-*l/55.1%
+-commutative55.1%
Simplified55.1%
Taylor expanded in x around inf 58.0%
associate-*r/72.0%
*-commutative72.0%
Simplified72.0%
if -4.19999999999999977e-5 < y < 7.7999999999999999e-6Initial program 100.0%
associate-*l/100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 99.9%
if 2.75000000000000011e97 < y < 9.0000000000000001e125Initial program 16.1%
associate-*l/16.3%
+-commutative16.3%
Simplified16.3%
Taylor expanded in y around -inf 99.6%
mul-1-neg99.6%
unsub-neg99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 74.9%
if 9.0000000000000001e125 < y Initial program 24.1%
associate-*l/66.3%
+-commutative66.3%
Simplified66.3%
Taylor expanded in y around inf 78.8%
Final simplification86.3%
(FPCore (x y)
:precision binary64
(if (<= y -90.0)
x
(if (<= y -3.4e-104)
(* y x)
(if (<= y 1.24e-123)
1.0
(if (<= y 1.05e-50) (* y x) (if (<= y 5.5e-5) 1.0 x))))))
double code(double x, double y) {
double tmp;
if (y <= -90.0) {
tmp = x;
} else if (y <= -3.4e-104) {
tmp = y * x;
} else if (y <= 1.24e-123) {
tmp = 1.0;
} else if (y <= 1.05e-50) {
tmp = y * x;
} else if (y <= 5.5e-5) {
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 <= (-90.0d0)) then
tmp = x
else if (y <= (-3.4d-104)) then
tmp = y * x
else if (y <= 1.24d-123) then
tmp = 1.0d0
else if (y <= 1.05d-50) then
tmp = y * x
else if (y <= 5.5d-5) 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 <= -90.0) {
tmp = x;
} else if (y <= -3.4e-104) {
tmp = y * x;
} else if (y <= 1.24e-123) {
tmp = 1.0;
} else if (y <= 1.05e-50) {
tmp = y * x;
} else if (y <= 5.5e-5) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -90.0: tmp = x elif y <= -3.4e-104: tmp = y * x elif y <= 1.24e-123: tmp = 1.0 elif y <= 1.05e-50: tmp = y * x elif y <= 5.5e-5: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -90.0) tmp = x; elseif (y <= -3.4e-104) tmp = Float64(y * x); elseif (y <= 1.24e-123) tmp = 1.0; elseif (y <= 1.05e-50) tmp = Float64(y * x); elseif (y <= 5.5e-5) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -90.0) tmp = x; elseif (y <= -3.4e-104) tmp = y * x; elseif (y <= 1.24e-123) tmp = 1.0; elseif (y <= 1.05e-50) tmp = y * x; elseif (y <= 5.5e-5) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -90.0], x, If[LessEqual[y, -3.4e-104], N[(y * x), $MachinePrecision], If[LessEqual[y, 1.24e-123], 1.0, If[LessEqual[y, 1.05e-50], N[(y * x), $MachinePrecision], If[LessEqual[y, 5.5e-5], 1.0, x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -90:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -3.4 \cdot 10^{-104}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 1.24 \cdot 10^{-123}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{-50}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-5}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -90 or 5.5000000000000002e-5 < y Initial program 34.4%
associate-*l/54.5%
+-commutative54.5%
Simplified54.5%
Taylor expanded in y around inf 67.2%
if -90 < y < -3.40000000000000015e-104 or 1.2399999999999999e-123 < y < 1.05e-50Initial program 99.8%
associate-*l/99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 61.1%
/-rgt-identity61.1%
associate-/r/60.9%
associate-/r*60.9%
+-commutative60.9%
distribute-lft-in60.9%
lft-mult-inverse60.9%
*-rgt-identity60.9%
Simplified60.9%
Taylor expanded in y around 0 58.5%
*-commutative58.5%
Simplified58.5%
if -3.40000000000000015e-104 < y < 1.2399999999999999e-123 or 1.05e-50 < y < 5.5000000000000002e-5Initial program 100.0%
associate-*l/100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 87.7%
Final simplification71.9%
(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 33.8%
associate-*l/54.1%
+-commutative54.1%
Simplified54.1%
Taylor expanded in y around -inf 97.4%
mul-1-neg97.4%
unsub-neg97.4%
sub-neg97.4%
metadata-eval97.4%
Simplified97.4%
if -1 < y < 1Initial program 100.0%
associate-*l/100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 97.8%
Final simplification97.6%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 5.5e-5) 1.0 x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 5.5e-5) {
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 <= 5.5d-5) 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 <= 5.5e-5) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 5.5e-5: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 5.5e-5) 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 <= 5.5e-5) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 5.5e-5], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-5}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 5.5000000000000002e-5 < y Initial program 34.8%
associate-*l/54.7%
+-commutative54.7%
Simplified54.7%
Taylor expanded in y around inf 66.7%
if -1 < y < 5.5000000000000002e-5Initial program 100.0%
associate-*l/100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 69.9%
Final simplification68.3%
(FPCore (x y) :precision binary64 1.0)
double code(double x, double y) {
return 1.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0
end function
public static double code(double x, double y) {
return 1.0;
}
def code(x, y): return 1.0
function code(x, y) return 1.0 end
function tmp = code(x, y) tmp = 1.0; end
code[x_, y_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 66.6%
associate-*l/76.8%
+-commutative76.8%
Simplified76.8%
Taylor expanded in y around 0 36.2%
Final simplification36.2%
(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 2023318
(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))))