
(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 11 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 -10200.0) (not (<= y 14500.0)))
(-
x
(-
(/ (- 1.0 x) (pow y 2.0))
(+ (/ (- 1.0 x) (pow y 3.0)) (/ (- 1.0 x) y))))
(+ 1.0 (/ (* y (+ x -1.0)) (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -10200.0) || !(y <= 14500.0)) {
tmp = x - (((1.0 - x) / pow(y, 2.0)) - (((1.0 - x) / pow(y, 3.0)) + ((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 <= (-10200.0d0)) .or. (.not. (y <= 14500.0d0))) then
tmp = x - (((1.0d0 - x) / (y ** 2.0d0)) - (((1.0d0 - x) / (y ** 3.0d0)) + ((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 <= -10200.0) || !(y <= 14500.0)) {
tmp = x - (((1.0 - x) / Math.pow(y, 2.0)) - (((1.0 - x) / Math.pow(y, 3.0)) + ((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 <= -10200.0) or not (y <= 14500.0): tmp = x - (((1.0 - x) / math.pow(y, 2.0)) - (((1.0 - x) / math.pow(y, 3.0)) + ((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 <= -10200.0) || !(y <= 14500.0)) tmp = Float64(x - Float64(Float64(Float64(1.0 - x) / (y ^ 2.0)) - Float64(Float64(Float64(1.0 - x) / (y ^ 3.0)) + 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 <= -10200.0) || ~((y <= 14500.0))) tmp = x - (((1.0 - x) / (y ^ 2.0)) - (((1.0 - x) / (y ^ 3.0)) + ((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, -10200.0], N[Not[LessEqual[y, 14500.0]], $MachinePrecision]], N[(x - N[(N[(N[(1.0 - x), $MachinePrecision] / N[Power[y, 2.0], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 - x), $MachinePrecision] / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $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 -10200 \lor \neg \left(y \leq 14500\right):\\
\;\;\;\;x - \left(\frac{1 - x}{{y}^{2}} - \left(\frac{1 - x}{{y}^{3}} + \frac{1 - x}{y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y \cdot \left(x + -1\right)}{y + 1}\\
\end{array}
\end{array}
if y < -10200 or 14500 < y Initial program 34.5%
associate-*l/54.7%
+-commutative54.7%
Simplified54.7%
Taylor expanded in y around -inf 100.0%
associate--l+100.0%
associate-+r+100.0%
associate--l+100.0%
Simplified100.0%
if -10200 < y < 14500Initial program 100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (if (or (<= y -160000.0) (not (<= y 260000.0))) (+ (/ (+ x -1.0) (pow y 2.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 <= -160000.0) || !(y <= 260000.0)) {
tmp = ((x + -1.0) / pow(y, 2.0)) + (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 <= (-160000.0d0)) .or. (.not. (y <= 260000.0d0))) then
tmp = ((x + (-1.0d0)) / (y ** 2.0d0)) + (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 <= -160000.0) || !(y <= 260000.0)) {
tmp = ((x + -1.0) / Math.pow(y, 2.0)) + (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 <= -160000.0) or not (y <= 260000.0): tmp = ((x + -1.0) / math.pow(y, 2.0)) + (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 <= -160000.0) || !(y <= 260000.0)) tmp = Float64(Float64(Float64(x + -1.0) / (y ^ 2.0)) + 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 <= -160000.0) || ~((y <= 260000.0))) tmp = ((x + -1.0) / (y ^ 2.0)) + (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, -160000.0], N[Not[LessEqual[y, 260000.0]], $MachinePrecision]], N[(N[(N[(x + -1.0), $MachinePrecision] / N[Power[y, 2.0], $MachinePrecision]), $MachinePrecision] + N[(x + N[(N[(1.0 - x), $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 -160000 \lor \neg \left(y \leq 260000\right):\\
\;\;\;\;\frac{x + -1}{{y}^{2}} + \left(x + \frac{1 - x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y \cdot \left(x + -1\right)}{y + 1}\\
\end{array}
\end{array}
if y < -1.6e5 or 2.6e5 < y Initial program 34.2%
associate-*l/54.5%
+-commutative54.5%
Simplified54.5%
Taylor expanded in y around -inf 99.8%
associate-+r+99.8%
associate--l+99.8%
mul-1-neg99.8%
unsub-neg99.8%
sub-neg99.8%
metadata-eval99.8%
div-sub99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
if -1.6e5 < y < 2.6e5Initial program 99.8%
Final simplification99.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- x (/ x y))))
(if (<= y -1.6e+56)
x
(if (<= y -2.6e+21)
(/ 1.0 y)
(if (<= y -1000000.0)
t_0
(if (<= y -2.5e-84) (* y x) (if (<= y 4900000000000.0) 1.0 t_0)))))))
double code(double x, double y) {
double t_0 = x - (x / y);
double tmp;
if (y <= -1.6e+56) {
tmp = x;
} else if (y <= -2.6e+21) {
tmp = 1.0 / y;
} else if (y <= -1000000.0) {
tmp = t_0;
} else if (y <= -2.5e-84) {
tmp = y * x;
} else if (y <= 4900000000000.0) {
tmp = 1.0;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x - (x / y)
if (y <= (-1.6d+56)) then
tmp = x
else if (y <= (-2.6d+21)) then
tmp = 1.0d0 / y
else if (y <= (-1000000.0d0)) then
tmp = t_0
else if (y <= (-2.5d-84)) then
tmp = y * x
else if (y <= 4900000000000.0d0) then
tmp = 1.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x - (x / y);
double tmp;
if (y <= -1.6e+56) {
tmp = x;
} else if (y <= -2.6e+21) {
tmp = 1.0 / y;
} else if (y <= -1000000.0) {
tmp = t_0;
} else if (y <= -2.5e-84) {
tmp = y * x;
} else if (y <= 4900000000000.0) {
tmp = 1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x - (x / y) tmp = 0 if y <= -1.6e+56: tmp = x elif y <= -2.6e+21: tmp = 1.0 / y elif y <= -1000000.0: tmp = t_0 elif y <= -2.5e-84: tmp = y * x elif y <= 4900000000000.0: tmp = 1.0 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x - Float64(x / y)) tmp = 0.0 if (y <= -1.6e+56) tmp = x; elseif (y <= -2.6e+21) tmp = Float64(1.0 / y); elseif (y <= -1000000.0) tmp = t_0; elseif (y <= -2.5e-84) tmp = Float64(y * x); elseif (y <= 4900000000000.0) tmp = 1.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = x - (x / y); tmp = 0.0; if (y <= -1.6e+56) tmp = x; elseif (y <= -2.6e+21) tmp = 1.0 / y; elseif (y <= -1000000.0) tmp = t_0; elseif (y <= -2.5e-84) tmp = y * x; elseif (y <= 4900000000000.0) tmp = 1.0; 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, -1.6e+56], x, If[LessEqual[y, -2.6e+21], N[(1.0 / y), $MachinePrecision], If[LessEqual[y, -1000000.0], t$95$0, If[LessEqual[y, -2.5e-84], N[(y * x), $MachinePrecision], If[LessEqual[y, 4900000000000.0], 1.0, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x - \frac{x}{y}\\
\mathbf{if}\;y \leq -1.6 \cdot 10^{+56}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -2.6 \cdot 10^{+21}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{elif}\;y \leq -1000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -2.5 \cdot 10^{-84}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 4900000000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.60000000000000002e56Initial program 29.6%
associate-*l/47.9%
+-commutative47.9%
Simplified47.9%
Taylor expanded in y around inf 83.5%
if -1.60000000000000002e56 < y < -2.6e21Initial program 3.4%
associate-*l/3.4%
+-commutative3.4%
Simplified3.4%
Taylor expanded in x around 0 3.4%
Taylor expanded in y around inf 100.0%
if -2.6e21 < y < -1e6 or 4.9e12 < y Initial program 39.7%
associate-*l/63.8%
+-commutative63.8%
Simplified63.8%
Taylor expanded in x around inf 55.0%
Taylor expanded in y around inf 79.2%
mul-1-neg79.2%
unsub-neg79.2%
Simplified79.2%
if -1e6 < y < -2.5000000000000001e-84Initial program 98.7%
associate-*l/98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in x around inf 62.5%
Taylor expanded in y around 0 58.8%
*-commutative58.8%
Simplified58.8%
if -2.5000000000000001e-84 < y < 4.9e12Initial program 99.2%
associate-*l/99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in y around 0 76.3%
Final simplification77.8%
(FPCore (x y)
:precision binary64
(if (<= y -2.4e+54)
x
(if (<= y -3.85e+21)
(/ 1.0 y)
(if (or (<= y -1.0) (not (<= y 1.15)))
(- x (/ x y))
(+ 1.0 (* y (+ x -1.0)))))))
double code(double x, double y) {
double tmp;
if (y <= -2.4e+54) {
tmp = x;
} else if (y <= -3.85e+21) {
tmp = 1.0 / y;
} else if ((y <= -1.0) || !(y <= 1.15)) {
tmp = x - (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 <= (-2.4d+54)) then
tmp = x
else if (y <= (-3.85d+21)) then
tmp = 1.0d0 / y
else if ((y <= (-1.0d0)) .or. (.not. (y <= 1.15d0))) then
tmp = x - (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 <= -2.4e+54) {
tmp = x;
} else if (y <= -3.85e+21) {
tmp = 1.0 / y;
} else if ((y <= -1.0) || !(y <= 1.15)) {
tmp = x - (x / y);
} else {
tmp = 1.0 + (y * (x + -1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.4e+54: tmp = x elif y <= -3.85e+21: tmp = 1.0 / y elif (y <= -1.0) or not (y <= 1.15): tmp = x - (x / y) else: tmp = 1.0 + (y * (x + -1.0)) return tmp
function code(x, y) tmp = 0.0 if (y <= -2.4e+54) tmp = x; elseif (y <= -3.85e+21) tmp = Float64(1.0 / y); elseif ((y <= -1.0) || !(y <= 1.15)) tmp = Float64(x - Float64(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 <= -2.4e+54) tmp = x; elseif (y <= -3.85e+21) tmp = 1.0 / y; elseif ((y <= -1.0) || ~((y <= 1.15))) tmp = x - (x / y); else tmp = 1.0 + (y * (x + -1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.4e+54], x, If[LessEqual[y, -3.85e+21], N[(1.0 / y), $MachinePrecision], If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.15]], $MachinePrecision]], N[(x - N[(x / 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 -2.4 \cdot 10^{+54}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -3.85 \cdot 10^{+21}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{elif}\;y \leq -1 \lor \neg \left(y \leq 1.15\right):\\
\;\;\;\;x - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \left(x + -1\right)\\
\end{array}
\end{array}
if y < -2.39999999999999998e54Initial program 29.6%
associate-*l/47.9%
+-commutative47.9%
Simplified47.9%
Taylor expanded in y around inf 83.5%
if -2.39999999999999998e54 < y < -3.85e21Initial program 3.4%
associate-*l/3.4%
+-commutative3.4%
Simplified3.4%
Taylor expanded in x around 0 3.4%
Taylor expanded in y around inf 100.0%
if -3.85e21 < y < -1 or 1.1499999999999999 < y Initial program 40.6%
associate-*l/63.7%
+-commutative63.7%
Simplified63.7%
Taylor expanded in x around inf 52.8%
Taylor expanded in y around inf 76.0%
mul-1-neg76.0%
unsub-neg76.0%
Simplified76.0%
if -1 < y < 1.1499999999999999Initial program 100.0%
associate-*l/100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 98.3%
Final simplification89.1%
(FPCore (x y)
:precision binary64
(if (<= y -2.05e+55)
x
(if (<= y -3.85e+21)
(/ 1.0 y)
(if (<= y -1000000.0)
x
(if (<= y -3.5e-84) (* y x) (if (<= y 4900000000000.0) 1.0 x))))))
double code(double x, double y) {
double tmp;
if (y <= -2.05e+55) {
tmp = x;
} else if (y <= -3.85e+21) {
tmp = 1.0 / y;
} else if (y <= -1000000.0) {
tmp = x;
} else if (y <= -3.5e-84) {
tmp = y * x;
} else if (y <= 4900000000000.0) {
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 <= (-2.05d+55)) then
tmp = x
else if (y <= (-3.85d+21)) then
tmp = 1.0d0 / y
else if (y <= (-1000000.0d0)) then
tmp = x
else if (y <= (-3.5d-84)) then
tmp = y * x
else if (y <= 4900000000000.0d0) 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 <= -2.05e+55) {
tmp = x;
} else if (y <= -3.85e+21) {
tmp = 1.0 / y;
} else if (y <= -1000000.0) {
tmp = x;
} else if (y <= -3.5e-84) {
tmp = y * x;
} else if (y <= 4900000000000.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.05e+55: tmp = x elif y <= -3.85e+21: tmp = 1.0 / y elif y <= -1000000.0: tmp = x elif y <= -3.5e-84: tmp = y * x elif y <= 4900000000000.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -2.05e+55) tmp = x; elseif (y <= -3.85e+21) tmp = Float64(1.0 / y); elseif (y <= -1000000.0) tmp = x; elseif (y <= -3.5e-84) tmp = Float64(y * x); elseif (y <= 4900000000000.0) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2.05e+55) tmp = x; elseif (y <= -3.85e+21) tmp = 1.0 / y; elseif (y <= -1000000.0) tmp = x; elseif (y <= -3.5e-84) tmp = y * x; elseif (y <= 4900000000000.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.05e+55], x, If[LessEqual[y, -3.85e+21], N[(1.0 / y), $MachinePrecision], If[LessEqual[y, -1000000.0], x, If[LessEqual[y, -3.5e-84], N[(y * x), $MachinePrecision], If[LessEqual[y, 4900000000000.0], 1.0, x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.05 \cdot 10^{+55}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -3.85 \cdot 10^{+21}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{elif}\;y \leq -1000000:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -3.5 \cdot 10^{-84}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 4900000000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.04999999999999991e55 or -3.85e21 < y < -1e6 or 4.9e12 < y Initial program 35.4%
associate-*l/57.1%
+-commutative57.1%
Simplified57.1%
Taylor expanded in y around inf 80.5%
if -2.04999999999999991e55 < y < -3.85e21Initial program 3.4%
associate-*l/3.4%
+-commutative3.4%
Simplified3.4%
Taylor expanded in x around 0 3.4%
Taylor expanded in y around inf 100.0%
if -1e6 < y < -3.5000000000000001e-84Initial program 98.7%
associate-*l/98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in x around inf 62.5%
Taylor expanded in y around 0 58.8%
*-commutative58.8%
Simplified58.8%
if -3.5000000000000001e-84 < y < 4.9e12Initial program 99.2%
associate-*l/99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in y around 0 76.3%
Final simplification77.6%
(FPCore (x y) :precision binary64 (if (or (<= y -9.6e+20) (not (<= y 170000000.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 <= -9.6e+20) || !(y <= 170000000.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 <= (-9.6d+20)) .or. (.not. (y <= 170000000.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 <= -9.6e+20) || !(y <= 170000000.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 <= -9.6e+20) or not (y <= 170000000.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 <= -9.6e+20) || !(y <= 170000000.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 <= -9.6e+20) || ~((y <= 170000000.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, -9.6e+20], N[Not[LessEqual[y, 170000000.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 -9.6 \cdot 10^{+20} \lor \neg \left(y \leq 170000000\right):\\
\;\;\;\;x + \frac{1 - x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\
\end{array}
\end{array}
if y < -9.6e20 or 1.7e8 < y Initial program 31.7%
associate-*l/52.9%
+-commutative52.9%
Simplified52.9%
Taylor expanded in y around inf 99.8%
associate--l+99.8%
div-sub99.8%
sub-neg99.8%
+-commutative99.8%
metadata-eval99.8%
distribute-neg-in99.8%
distribute-neg-frac99.8%
metadata-eval99.8%
sub-neg99.8%
unsub-neg99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
if -9.6e20 < y < 1.7e8Initial program 99.6%
associate-*l/99.6%
+-commutative99.6%
Simplified99.6%
Final simplification99.7%
(FPCore (x y) :precision binary64 (if (or (<= y -2.05e+18) (not (<= y 150000000.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 <= -2.05e+18) || !(y <= 150000000.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 <= (-2.05d+18)) .or. (.not. (y <= 150000000.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 <= -2.05e+18) || !(y <= 150000000.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 <= -2.05e+18) or not (y <= 150000000.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 <= -2.05e+18) || !(y <= 150000000.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 <= -2.05e+18) || ~((y <= 150000000.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, -2.05e+18], N[Not[LessEqual[y, 150000000.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 -2.05 \cdot 10^{+18} \lor \neg \left(y \leq 150000000\right):\\
\;\;\;\;x + \frac{1 - x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y \cdot \left(x + -1\right)}{y + 1}\\
\end{array}
\end{array}
if y < -2.05e18 or 1.5e8 < y Initial program 32.3%
associate-*l/53.3%
+-commutative53.3%
Simplified53.3%
Taylor expanded in y around inf 99.8%
associate--l+99.8%
div-sub99.8%
sub-neg99.8%
+-commutative99.8%
metadata-eval99.8%
distribute-neg-in99.8%
distribute-neg-frac99.8%
metadata-eval99.8%
sub-neg99.8%
unsub-neg99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
if -2.05e18 < y < 1.5e8Initial program 99.6%
Final simplification99.7%
(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 34.5%
associate-*l/54.7%
+-commutative54.7%
Simplified54.7%
Taylor expanded in y around inf 99.0%
associate--l+99.0%
div-sub99.0%
sub-neg99.0%
+-commutative99.0%
metadata-eval99.0%
distribute-neg-in99.0%
distribute-neg-frac99.0%
metadata-eval99.0%
sub-neg99.0%
unsub-neg99.0%
sub-neg99.0%
metadata-eval99.0%
Simplified99.0%
if -1 < y < 1Initial program 100.0%
associate-*l/100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 98.3%
Final simplification98.6%
(FPCore (x y) :precision binary64 (if (<= y -1000000.0) x (if (<= y -9.5e-84) (* y x) (if (<= y 4900000000000.0) 1.0 x))))
double code(double x, double y) {
double tmp;
if (y <= -1000000.0) {
tmp = x;
} else if (y <= -9.5e-84) {
tmp = y * x;
} else if (y <= 4900000000000.0) {
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 <= (-1000000.0d0)) then
tmp = x
else if (y <= (-9.5d-84)) then
tmp = y * x
else if (y <= 4900000000000.0d0) 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 <= -1000000.0) {
tmp = x;
} else if (y <= -9.5e-84) {
tmp = y * x;
} else if (y <= 4900000000000.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1000000.0: tmp = x elif y <= -9.5e-84: tmp = y * x elif y <= 4900000000000.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1000000.0) tmp = x; elseif (y <= -9.5e-84) tmp = Float64(y * x); elseif (y <= 4900000000000.0) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1000000.0) tmp = x; elseif (y <= -9.5e-84) tmp = y * x; elseif (y <= 4900000000000.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1000000.0], x, If[LessEqual[y, -9.5e-84], N[(y * x), $MachinePrecision], If[LessEqual[y, 4900000000000.0], 1.0, x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1000000:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -9.5 \cdot 10^{-84}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 4900000000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1e6 or 4.9e12 < y Initial program 33.9%
associate-*l/54.5%
+-commutative54.5%
Simplified54.5%
Taylor expanded in y around inf 76.9%
if -1e6 < y < -9.49999999999999941e-84Initial program 98.7%
associate-*l/98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in x around inf 62.5%
Taylor expanded in y around 0 58.8%
*-commutative58.8%
Simplified58.8%
if -9.49999999999999941e-84 < y < 4.9e12Initial program 99.2%
associate-*l/99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in y around 0 76.3%
Final simplification75.4%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 4900000000000.0) 1.0 x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 4900000000000.0) {
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 <= 4900000000000.0d0) 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 <= 4900000000000.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 4900000000000.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 4900000000000.0) 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 <= 4900000000000.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 4900000000000.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 4900000000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 4.9e12 < y Initial program 34.2%
associate-*l/54.7%
+-commutative54.7%
Simplified54.7%
Taylor expanded in y around inf 76.3%
if -1 < y < 4.9e12Initial program 99.3%
associate-*l/99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in y around 0 70.6%
Final simplification73.4%
(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 67.0%
associate-*l/77.2%
+-commutative77.2%
Simplified77.2%
Taylor expanded in y around 0 37.6%
Final simplification37.6%
(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 2024039
(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))))