
(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 -50000.0) (not (<= y 44000.0))) (+ x (+ (/ (- 1.0 x) y) (+ (/ (/ (+ x -1.0) y) y) (/ 1.0 (pow y 3.0))))) (- 1.0 (/ (* y (- 1.0 x)) (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -50000.0) || !(y <= 44000.0)) {
tmp = x + (((1.0 - x) / y) + ((((x + -1.0) / y) / y) + (1.0 / pow(y, 3.0))));
} else {
tmp = 1.0 - ((y * (1.0 - x)) / (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 <= (-50000.0d0)) .or. (.not. (y <= 44000.0d0))) then
tmp = x + (((1.0d0 - x) / y) + ((((x + (-1.0d0)) / y) / y) + (1.0d0 / (y ** 3.0d0))))
else
tmp = 1.0d0 - ((y * (1.0d0 - x)) / (y + 1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -50000.0) || !(y <= 44000.0)) {
tmp = x + (((1.0 - x) / y) + ((((x + -1.0) / y) / y) + (1.0 / Math.pow(y, 3.0))));
} else {
tmp = 1.0 - ((y * (1.0 - x)) / (y + 1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -50000.0) or not (y <= 44000.0): tmp = x + (((1.0 - x) / y) + ((((x + -1.0) / y) / y) + (1.0 / math.pow(y, 3.0)))) else: tmp = 1.0 - ((y * (1.0 - x)) / (y + 1.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -50000.0) || !(y <= 44000.0)) tmp = Float64(x + Float64(Float64(Float64(1.0 - x) / y) + Float64(Float64(Float64(Float64(x + -1.0) / y) / y) + Float64(1.0 / (y ^ 3.0))))); else tmp = Float64(1.0 - Float64(Float64(y * Float64(1.0 - x)) / Float64(y + 1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -50000.0) || ~((y <= 44000.0))) tmp = x + (((1.0 - x) / y) + ((((x + -1.0) / y) / y) + (1.0 / (y ^ 3.0)))); else tmp = 1.0 - ((y * (1.0 - x)) / (y + 1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -50000.0], N[Not[LessEqual[y, 44000.0]], $MachinePrecision]], N[(x + N[(N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision] + N[(N[(N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision] / y), $MachinePrecision] + N[(1.0 / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(y * N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -50000 \lor \neg \left(y \leq 44000\right):\\
\;\;\;\;x + \left(\frac{1 - x}{y} + \left(\frac{\frac{x + -1}{y}}{y} + \frac{1}{{y}^{3}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y \cdot \left(1 - x\right)}{y + 1}\\
\end{array}
\end{array}
if y < -5e4 or 44000 < y Initial program 34.5%
associate-/l*54.9%
remove-double-neg54.9%
remove-double-neg54.9%
+-commutative54.9%
Simplified54.9%
Taylor expanded in y around -inf 100.0%
associate--l+100.0%
associate--l+100.0%
associate-*r/100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-lft-in100.0%
neg-mul-1100.0%
metadata-eval100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
*-un-lft-identity100.0%
unpow2100.0%
times-frac100.0%
Applied egg-rr100.0%
associate-*l/100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
if -5e4 < y < 44000Initial program 100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- x (/ x y))))
(if (<= y -3.1e+55)
x
(if (<= y -3.1e+21)
(/ 1.0 y)
(if (<= y -1000000.0)
t_0
(if (<= y -8e-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 <= -3.1e+55) {
tmp = x;
} else if (y <= -3.1e+21) {
tmp = 1.0 / y;
} else if (y <= -1000000.0) {
tmp = t_0;
} else if (y <= -8e-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 <= (-3.1d+55)) then
tmp = x
else if (y <= (-3.1d+21)) then
tmp = 1.0d0 / y
else if (y <= (-1000000.0d0)) then
tmp = t_0
else if (y <= (-8d-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 <= -3.1e+55) {
tmp = x;
} else if (y <= -3.1e+21) {
tmp = 1.0 / y;
} else if (y <= -1000000.0) {
tmp = t_0;
} else if (y <= -8e-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 <= -3.1e+55: tmp = x elif y <= -3.1e+21: tmp = 1.0 / y elif y <= -1000000.0: tmp = t_0 elif y <= -8e-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 <= -3.1e+55) tmp = x; elseif (y <= -3.1e+21) tmp = Float64(1.0 / y); elseif (y <= -1000000.0) tmp = t_0; elseif (y <= -8e-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 <= -3.1e+55) tmp = x; elseif (y <= -3.1e+21) tmp = 1.0 / y; elseif (y <= -1000000.0) tmp = t_0; elseif (y <= -8e-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, -3.1e+55], x, If[LessEqual[y, -3.1e+21], N[(1.0 / y), $MachinePrecision], If[LessEqual[y, -1000000.0], t$95$0, If[LessEqual[y, -8e-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 -3.1 \cdot 10^{+55}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -3.1 \cdot 10^{+21}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{elif}\;y \leq -1000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -8 \cdot 10^{-84}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 4900000000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -3.09999999999999994e55Initial program 29.6%
associate-/l*48.1%
remove-double-neg48.1%
remove-double-neg48.1%
+-commutative48.1%
Simplified48.1%
Taylor expanded in y around inf 83.5%
if -3.09999999999999994e55 < y < -3.1e21Initial program 3.4%
associate-/l*3.4%
remove-double-neg3.4%
remove-double-neg3.4%
+-commutative3.4%
Simplified3.4%
Taylor expanded in y around inf 100.0%
associate--l+100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
if -3.1e21 < y < -1e6 or 4.9e12 < y Initial program 39.7%
associate-/l*64.0%
remove-double-neg64.0%
remove-double-neg64.0%
+-commutative64.0%
Simplified64.0%
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 < -8.0000000000000003e-84Initial program 98.7%
associate-/l*98.6%
remove-double-neg98.6%
remove-double-neg98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in y around 0 90.7%
Taylor expanded in x around inf 58.8%
*-commutative58.8%
Simplified58.8%
if -8.0000000000000003e-84 < y < 4.9e12Initial program 99.2%
associate-/l*99.2%
remove-double-neg99.2%
remove-double-neg99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in y around 0 76.3%
Final simplification77.8%
(FPCore (x y)
:precision binary64
(if (<= y -2.3e+55)
x
(if (<= y -1.9e+21)
(/ 1.0 y)
(if (<= y -1000000.0)
x
(if (<= y -2.1e-84) (* y x) (if (<= y 4900000000000.0) 1.0 x))))))
double code(double x, double y) {
double tmp;
if (y <= -2.3e+55) {
tmp = x;
} else if (y <= -1.9e+21) {
tmp = 1.0 / y;
} else if (y <= -1000000.0) {
tmp = x;
} else if (y <= -2.1e-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.3d+55)) then
tmp = x
else if (y <= (-1.9d+21)) then
tmp = 1.0d0 / y
else if (y <= (-1000000.0d0)) then
tmp = x
else if (y <= (-2.1d-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.3e+55) {
tmp = x;
} else if (y <= -1.9e+21) {
tmp = 1.0 / y;
} else if (y <= -1000000.0) {
tmp = x;
} else if (y <= -2.1e-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.3e+55: tmp = x elif y <= -1.9e+21: tmp = 1.0 / y elif y <= -1000000.0: tmp = x elif y <= -2.1e-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.3e+55) tmp = x; elseif (y <= -1.9e+21) tmp = Float64(1.0 / y); elseif (y <= -1000000.0) tmp = x; elseif (y <= -2.1e-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.3e+55) tmp = x; elseif (y <= -1.9e+21) tmp = 1.0 / y; elseif (y <= -1000000.0) tmp = x; elseif (y <= -2.1e-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.3e+55], x, If[LessEqual[y, -1.9e+21], N[(1.0 / y), $MachinePrecision], If[LessEqual[y, -1000000.0], x, If[LessEqual[y, -2.1e-84], N[(y * x), $MachinePrecision], If[LessEqual[y, 4900000000000.0], 1.0, x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{+55}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1.9 \cdot 10^{+21}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{elif}\;y \leq -1000000:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -2.1 \cdot 10^{-84}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 4900000000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.29999999999999987e55 or -1.9e21 < y < -1e6 or 4.9e12 < y Initial program 35.4%
associate-/l*57.2%
remove-double-neg57.2%
remove-double-neg57.2%
+-commutative57.2%
Simplified57.2%
Taylor expanded in y around inf 80.5%
if -2.29999999999999987e55 < y < -1.9e21Initial program 3.4%
associate-/l*3.4%
remove-double-neg3.4%
remove-double-neg3.4%
+-commutative3.4%
Simplified3.4%
Taylor expanded in y around inf 100.0%
associate--l+100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
if -1e6 < y < -2.09999999999999998e-84Initial program 98.7%
associate-/l*98.6%
remove-double-neg98.6%
remove-double-neg98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in y around 0 90.7%
Taylor expanded in x around inf 58.8%
*-commutative58.8%
Simplified58.8%
if -2.09999999999999998e-84 < y < 4.9e12Initial program 99.2%
associate-/l*99.2%
remove-double-neg99.2%
remove-double-neg99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in y around 0 76.3%
Final simplification77.6%
(FPCore (x y) :precision binary64 (if (or (<= y -160000.0) (not (<= y 260000.0))) (+ (/ (/ (+ x -1.0) y) y) (+ x (/ (- 1.0 x) y))) (- 1.0 (/ (* y (- 1.0 x)) (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -160000.0) || !(y <= 260000.0)) {
tmp = (((x + -1.0) / y) / y) + (x + ((1.0 - x) / y));
} else {
tmp = 1.0 - ((y * (1.0 - x)) / (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) / y) + (x + ((1.0d0 - x) / y))
else
tmp = 1.0d0 - ((y * (1.0d0 - x)) / (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) / y) / y) + (x + ((1.0 - x) / y));
} else {
tmp = 1.0 - ((y * (1.0 - x)) / (y + 1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -160000.0) or not (y <= 260000.0): tmp = (((x + -1.0) / y) / y) + (x + ((1.0 - x) / y)) else: tmp = 1.0 - ((y * (1.0 - x)) / (y + 1.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -160000.0) || !(y <= 260000.0)) tmp = Float64(Float64(Float64(Float64(x + -1.0) / y) / y) + Float64(x + Float64(Float64(1.0 - x) / y))); else tmp = Float64(1.0 - Float64(Float64(y * Float64(1.0 - x)) / 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) / y) + (x + ((1.0 - x) / y)); else tmp = 1.0 - ((y * (1.0 - x)) / (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[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision] / y), $MachinePrecision] + N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(y * N[(1.0 - x), $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{\frac{x + -1}{y}}{y} + \left(x + \frac{1 - x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y \cdot \left(1 - x\right)}{y + 1}\\
\end{array}
\end{array}
if y < -1.6e5 or 2.6e5 < y Initial program 34.2%
associate-/l*54.7%
remove-double-neg54.7%
remove-double-neg54.7%
+-commutative54.7%
Simplified54.7%
Taylor expanded in y around inf 99.8%
Simplified99.8%
unpow299.8%
associate-/l/99.8%
+-commutative99.8%
div-inv99.8%
fma-define99.8%
Applied egg-rr99.8%
fma-undefine99.8%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
if -1.6e5 < y < 2.6e5Initial program 99.8%
Final simplification99.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ x (/ (- 1.0 x) y))))
(if (<= y -1.0)
t_0
(if (<= y -7e-84) (* y x) (if (<= y 0.96) (- 1.0 y) t_0)))))
double code(double x, double y) {
double t_0 = x + ((1.0 - x) / y);
double tmp;
if (y <= -1.0) {
tmp = t_0;
} else if (y <= -7e-84) {
tmp = y * x;
} else if (y <= 0.96) {
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 + ((1.0d0 - x) / y)
if (y <= (-1.0d0)) then
tmp = t_0
else if (y <= (-7d-84)) then
tmp = y * x
else if (y <= 0.96d0) 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 + ((1.0 - x) / y);
double tmp;
if (y <= -1.0) {
tmp = t_0;
} else if (y <= -7e-84) {
tmp = y * x;
} else if (y <= 0.96) {
tmp = 1.0 - y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x + ((1.0 - x) / y) tmp = 0 if y <= -1.0: tmp = t_0 elif y <= -7e-84: tmp = y * x elif y <= 0.96: tmp = 1.0 - y else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x + Float64(Float64(1.0 - x) / y)) tmp = 0.0 if (y <= -1.0) tmp = t_0; elseif (y <= -7e-84) tmp = Float64(y * x); elseif (y <= 0.96) tmp = Float64(1.0 - y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = x + ((1.0 - x) / y); tmp = 0.0; if (y <= -1.0) tmp = t_0; elseif (y <= -7e-84) tmp = y * x; elseif (y <= 0.96) tmp = 1.0 - y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.0], t$95$0, If[LessEqual[y, -7e-84], N[(y * x), $MachinePrecision], If[LessEqual[y, 0.96], N[(1.0 - y), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \frac{1 - x}{y}\\
\mathbf{if}\;y \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -7 \cdot 10^{-84}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 0.96:\\
\;\;\;\;1 - y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1 or 0.95999999999999996 < y Initial program 34.5%
associate-/l*54.9%
remove-double-neg54.9%
remove-double-neg54.9%
+-commutative54.9%
Simplified54.9%
Taylor expanded in y around inf 99.0%
associate--l+99.0%
div-sub99.0%
Simplified99.0%
if -1 < y < -7.0000000000000002e-84Initial program 100.0%
associate-/l*99.9%
remove-double-neg99.9%
remove-double-neg99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 95.9%
Taylor expanded in x around inf 61.9%
*-commutative61.9%
Simplified61.9%
if -7.0000000000000002e-84 < y < 0.95999999999999996Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 98.6%
Taylor expanded in x around 0 77.6%
Final simplification87.3%
(FPCore (x y) :precision binary64 (if (or (<= y -270000000.0) (not (<= y 170000000.0))) (+ x (/ (- 1.0 x) y)) (+ 1.0 (* (/ y (+ y 1.0)) (+ x -1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -270000000.0) || !(y <= 170000000.0)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 + ((y / (y + 1.0)) * (x + -1.0));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-270000000.0d0)) .or. (.not. (y <= 170000000.0d0))) then
tmp = x + ((1.0d0 - x) / y)
else
tmp = 1.0d0 + ((y / (y + 1.0d0)) * (x + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -270000000.0) || !(y <= 170000000.0)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 + ((y / (y + 1.0)) * (x + -1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -270000000.0) or not (y <= 170000000.0): tmp = x + ((1.0 - x) / y) else: tmp = 1.0 + ((y / (y + 1.0)) * (x + -1.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -270000000.0) || !(y <= 170000000.0)) tmp = Float64(x + Float64(Float64(1.0 - x) / y)); else tmp = Float64(1.0 + Float64(Float64(y / Float64(y + 1.0)) * Float64(x + -1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -270000000.0) || ~((y <= 170000000.0))) tmp = x + ((1.0 - x) / y); else tmp = 1.0 + ((y / (y + 1.0)) * (x + -1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -270000000.0], N[Not[LessEqual[y, 170000000.0]], $MachinePrecision]], N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -270000000 \lor \neg \left(y \leq 170000000\right):\\
\;\;\;\;x + \frac{1 - x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y}{y + 1} \cdot \left(x + -1\right)\\
\end{array}
\end{array}
if y < -2.7e8 or 1.7e8 < y Initial program 33.3%
associate-/l*54.2%
remove-double-neg54.2%
remove-double-neg54.2%
+-commutative54.2%
Simplified54.2%
Taylor expanded in y around inf 99.8%
associate--l+99.8%
div-sub99.8%
Simplified99.8%
if -2.7e8 < y < 1.7e8Initial program 99.6%
associate-/l*99.6%
remove-double-neg99.6%
remove-double-neg99.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 (- 1.0 x)) (+ 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 * (1.0 - x)) / (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 * (1.0d0 - x)) / (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 * (1.0 - x)) / (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 * (1.0 - x)) / (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(1.0 - x)) / 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 * (1.0 - x)) / (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[(1.0 - x), $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(1 - x\right)}{y + 1}\\
\end{array}
\end{array}
if y < -2.05e18 or 1.5e8 < y Initial program 32.3%
associate-/l*53.4%
remove-double-neg53.4%
remove-double-neg53.4%
+-commutative53.4%
Simplified53.4%
Taylor expanded in y around inf 99.8%
associate--l+99.8%
div-sub99.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 (- 1.0 x)))))
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 * (1.0 - 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)) .or. (.not. (y <= 1.0d0))) then
tmp = x + ((1.0d0 - x) / y)
else
tmp = 1.0d0 - (y * (1.0d0 - x))
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 * (1.0 - x));
}
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 * (1.0 - x)) 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(1.0 - x))); 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 * (1.0 - x)); 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[(1.0 - x), $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(1 - x\right)\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 34.5%
associate-/l*54.9%
remove-double-neg54.9%
remove-double-neg54.9%
+-commutative54.9%
Simplified54.9%
Taylor expanded in y around inf 99.0%
associate--l+99.0%
div-sub99.0%
Simplified99.0%
if -1 < y < 1Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 98.3%
Final 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.7%
remove-double-neg54.7%
remove-double-neg54.7%
+-commutative54.7%
Simplified54.7%
Taylor expanded in y around inf 76.9%
if -1e6 < y < -9.49999999999999941e-84Initial program 98.7%
associate-/l*98.6%
remove-double-neg98.6%
remove-double-neg98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in y around 0 90.7%
Taylor expanded in x around inf 58.8%
*-commutative58.8%
Simplified58.8%
if -9.49999999999999941e-84 < y < 4.9e12Initial program 99.2%
associate-/l*99.2%
remove-double-neg99.2%
remove-double-neg99.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.8%
remove-double-neg54.8%
remove-double-neg54.8%
+-commutative54.8%
Simplified54.8%
Taylor expanded in y around inf 76.3%
if -1 < y < 4.9e12Initial program 99.3%
associate-/l*99.3%
remove-double-neg99.3%
remove-double-neg99.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%
remove-double-neg77.2%
remove-double-neg77.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))))