
(FPCore (x y) :precision binary64 (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))
double code(double x, double y) {
return 1.0 - (((1.0 - x) * y) / (y + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 - (((1.0d0 - x) * y) / (y + 1.0d0))
end function
public static double code(double x, double y) {
return 1.0 - (((1.0 - x) * y) / (y + 1.0));
}
def code(x, y): return 1.0 - (((1.0 - x) * y) / (y + 1.0))
function code(x, y) return Float64(1.0 - Float64(Float64(Float64(1.0 - x) * y) / Float64(y + 1.0))) end
function tmp = code(x, y) tmp = 1.0 - (((1.0 - x) * y) / (y + 1.0)); end
code[x_, y_] := N[(1.0 - N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{\left(1 - x\right) \cdot y}{y + 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))
double code(double x, double y) {
return 1.0 - (((1.0 - x) * y) / (y + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 - (((1.0d0 - x) * y) / (y + 1.0d0))
end function
public static double code(double x, double y) {
return 1.0 - (((1.0 - x) * y) / (y + 1.0));
}
def code(x, y): return 1.0 - (((1.0 - x) * y) / (y + 1.0))
function code(x, y) return Float64(1.0 - Float64(Float64(Float64(1.0 - x) * y) / Float64(y + 1.0))) end
function tmp = code(x, y) tmp = 1.0 - (((1.0 - x) * y) / (y + 1.0)); end
code[x_, y_] := N[(1.0 - N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{\left(1 - x\right) \cdot y}{y + 1}
\end{array}
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (- x 1.0) y)))
(if (<= y -1200000000000.0)
(- x t_0)
(if (<= y 13200.0)
(fma (/ y (- y -1.0)) (+ -1.0 x) 1.0)
(+ (/ (fma t_0 (- (/ -1.0 y) -1.0) (- 1.0 x)) y) x)))))
double code(double x, double y) {
double t_0 = (x - 1.0) / y;
double tmp;
if (y <= -1200000000000.0) {
tmp = x - t_0;
} else if (y <= 13200.0) {
tmp = fma((y / (y - -1.0)), (-1.0 + x), 1.0);
} else {
tmp = (fma(t_0, ((-1.0 / y) - -1.0), (1.0 - x)) / y) + x;
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(x - 1.0) / y) tmp = 0.0 if (y <= -1200000000000.0) tmp = Float64(x - t_0); elseif (y <= 13200.0) tmp = fma(Float64(y / Float64(y - -1.0)), Float64(-1.0 + x), 1.0); else tmp = Float64(Float64(fma(t_0, Float64(Float64(-1.0 / y) - -1.0), Float64(1.0 - x)) / y) + x); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(x - 1.0), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[y, -1200000000000.0], N[(x - t$95$0), $MachinePrecision], If[LessEqual[y, 13200.0], N[(N[(y / N[(y - -1.0), $MachinePrecision]), $MachinePrecision] * N[(-1.0 + x), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(N[(t$95$0 * N[(N[(-1.0 / y), $MachinePrecision] - -1.0), $MachinePrecision] + N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x - 1}{y}\\
\mathbf{if}\;y \leq -1200000000000:\\
\;\;\;\;x - t\_0\\
\mathbf{elif}\;y \leq 13200:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{y - -1}, -1 + x, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_0, \frac{-1}{y} - -1, 1 - x\right)}{y} + x\\
\end{array}
\end{array}
if y < -1.2e12Initial program 23.5%
Taylor expanded in y around inf
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate--r-N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64100.0
Applied rewrites100.0%
if -1.2e12 < y < 13200Initial program 99.9%
Taylor expanded in y around inf
lower--.f644.7
Applied rewrites4.7%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
associate-/l*N/A
distribute-rgt-outN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-inN/A
distribute-neg-inN/A
mul-1-negN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites100.0%
if 13200 < y Initial program 32.8%
Taylor expanded in y around -inf
Applied rewrites100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* (- 1.0 x) y) (- y -1.0))))
(if (<= t_0 -4e+153)
(- 1.0 (- x))
(if (<= t_0 -20.0)
(* y x)
(if (<= t_0 0.5)
(fma (- y 1.0) y 1.0)
(if (or (<= t_0 2e+68) (not (<= t_0 2e+201)))
(- 1.0 (- 1.0 x))
(* y x)))))))
double code(double x, double y) {
double t_0 = ((1.0 - x) * y) / (y - -1.0);
double tmp;
if (t_0 <= -4e+153) {
tmp = 1.0 - -x;
} else if (t_0 <= -20.0) {
tmp = y * x;
} else if (t_0 <= 0.5) {
tmp = fma((y - 1.0), y, 1.0);
} else if ((t_0 <= 2e+68) || !(t_0 <= 2e+201)) {
tmp = 1.0 - (1.0 - x);
} else {
tmp = y * x;
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(Float64(1.0 - x) * y) / Float64(y - -1.0)) tmp = 0.0 if (t_0 <= -4e+153) tmp = Float64(1.0 - Float64(-x)); elseif (t_0 <= -20.0) tmp = Float64(y * x); elseif (t_0 <= 0.5) tmp = fma(Float64(y - 1.0), y, 1.0); elseif ((t_0 <= 2e+68) || !(t_0 <= 2e+201)) tmp = Float64(1.0 - Float64(1.0 - x)); else tmp = Float64(y * x); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(y - -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -4e+153], N[(1.0 - (-x)), $MachinePrecision], If[LessEqual[t$95$0, -20.0], N[(y * x), $MachinePrecision], If[LessEqual[t$95$0, 0.5], N[(N[(y - 1.0), $MachinePrecision] * y + 1.0), $MachinePrecision], If[Or[LessEqual[t$95$0, 2e+68], N[Not[LessEqual[t$95$0, 2e+201]], $MachinePrecision]], N[(1.0 - N[(1.0 - x), $MachinePrecision]), $MachinePrecision], N[(y * x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(1 - x\right) \cdot y}{y - -1}\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{+153}:\\
\;\;\;\;1 - \left(-x\right)\\
\mathbf{elif}\;t\_0 \leq -20:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;t\_0 \leq 0.5:\\
\;\;\;\;\mathsf{fma}\left(y - 1, y, 1\right)\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+68} \lor \neg \left(t\_0 \leq 2 \cdot 10^{+201}\right):\\
\;\;\;\;1 - \left(1 - x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < -4e153Initial program 39.4%
Taylor expanded in y around inf
lower--.f6486.1
Applied rewrites86.1%
Taylor expanded in x around inf
Applied rewrites86.1%
if -4e153 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < -20 or 1.99999999999999991e68 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 2.00000000000000008e201Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6468.0
Applied rewrites68.0%
Taylor expanded in x around inf
Applied rewrites66.3%
if -20 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 0.5Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower--.f6498.3
Applied rewrites98.3%
Taylor expanded in x around 0
Applied rewrites97.8%
if 0.5 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 1.99999999999999991e68 or 2.00000000000000008e201 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) Initial program 25.4%
Taylor expanded in y around inf
lower--.f6432.8
Applied rewrites32.8%
Final simplification66.5%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* (- 1.0 x) y) (- y -1.0))))
(if (<= t_0 -4e+153)
(- 1.0 (- x))
(if (<= t_0 -20.0)
(* y x)
(if (<= t_0 0.5)
(- 1.0 y)
(if (or (<= t_0 2e+68) (not (<= t_0 2e+201)))
(- 1.0 (- 1.0 x))
(* y x)))))))
double code(double x, double y) {
double t_0 = ((1.0 - x) * y) / (y - -1.0);
double tmp;
if (t_0 <= -4e+153) {
tmp = 1.0 - -x;
} else if (t_0 <= -20.0) {
tmp = y * x;
} else if (t_0 <= 0.5) {
tmp = 1.0 - y;
} else if ((t_0 <= 2e+68) || !(t_0 <= 2e+201)) {
tmp = 1.0 - (1.0 - x);
} else {
tmp = y * 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 = ((1.0d0 - x) * y) / (y - (-1.0d0))
if (t_0 <= (-4d+153)) then
tmp = 1.0d0 - -x
else if (t_0 <= (-20.0d0)) then
tmp = y * x
else if (t_0 <= 0.5d0) then
tmp = 1.0d0 - y
else if ((t_0 <= 2d+68) .or. (.not. (t_0 <= 2d+201))) then
tmp = 1.0d0 - (1.0d0 - x)
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = ((1.0 - x) * y) / (y - -1.0);
double tmp;
if (t_0 <= -4e+153) {
tmp = 1.0 - -x;
} else if (t_0 <= -20.0) {
tmp = y * x;
} else if (t_0 <= 0.5) {
tmp = 1.0 - y;
} else if ((t_0 <= 2e+68) || !(t_0 <= 2e+201)) {
tmp = 1.0 - (1.0 - x);
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y): t_0 = ((1.0 - x) * y) / (y - -1.0) tmp = 0 if t_0 <= -4e+153: tmp = 1.0 - -x elif t_0 <= -20.0: tmp = y * x elif t_0 <= 0.5: tmp = 1.0 - y elif (t_0 <= 2e+68) or not (t_0 <= 2e+201): tmp = 1.0 - (1.0 - x) else: tmp = y * x return tmp
function code(x, y) t_0 = Float64(Float64(Float64(1.0 - x) * y) / Float64(y - -1.0)) tmp = 0.0 if (t_0 <= -4e+153) tmp = Float64(1.0 - Float64(-x)); elseif (t_0 <= -20.0) tmp = Float64(y * x); elseif (t_0 <= 0.5) tmp = Float64(1.0 - y); elseif ((t_0 <= 2e+68) || !(t_0 <= 2e+201)) tmp = Float64(1.0 - Float64(1.0 - x)); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y) t_0 = ((1.0 - x) * y) / (y - -1.0); tmp = 0.0; if (t_0 <= -4e+153) tmp = 1.0 - -x; elseif (t_0 <= -20.0) tmp = y * x; elseif (t_0 <= 0.5) tmp = 1.0 - y; elseif ((t_0 <= 2e+68) || ~((t_0 <= 2e+201))) tmp = 1.0 - (1.0 - x); else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(y - -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -4e+153], N[(1.0 - (-x)), $MachinePrecision], If[LessEqual[t$95$0, -20.0], N[(y * x), $MachinePrecision], If[LessEqual[t$95$0, 0.5], N[(1.0 - y), $MachinePrecision], If[Or[LessEqual[t$95$0, 2e+68], N[Not[LessEqual[t$95$0, 2e+201]], $MachinePrecision]], N[(1.0 - N[(1.0 - x), $MachinePrecision]), $MachinePrecision], N[(y * x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(1 - x\right) \cdot y}{y - -1}\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{+153}:\\
\;\;\;\;1 - \left(-x\right)\\
\mathbf{elif}\;t\_0 \leq -20:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;t\_0 \leq 0.5:\\
\;\;\;\;1 - y\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+68} \lor \neg \left(t\_0 \leq 2 \cdot 10^{+201}\right):\\
\;\;\;\;1 - \left(1 - x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < -4e153Initial program 39.4%
Taylor expanded in y around inf
lower--.f6486.1
Applied rewrites86.1%
Taylor expanded in x around inf
Applied rewrites86.1%
if -4e153 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < -20 or 1.99999999999999991e68 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 2.00000000000000008e201Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6468.0
Applied rewrites68.0%
Taylor expanded in x around inf
Applied rewrites66.3%
if -20 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 0.5Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6498.2
Applied rewrites98.2%
Taylor expanded in x around 0
Applied rewrites97.8%
if 0.5 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 1.99999999999999991e68 or 2.00000000000000008e201 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) Initial program 25.4%
Taylor expanded in y around inf
lower--.f6432.8
Applied rewrites32.8%
Final simplification66.5%
(FPCore (x y)
:precision binary64
(if (<= y -1200000000000.0)
(- x (/ (- x 1.0) y))
(if (<= y 240000000.0)
(fma (/ (* (/ y (+ 1.0 y)) (- 1.0 x)) (- y 1.0)) (- (- y 1.0)) 1.0)
(- x (/ (* (- 1.0 (pow x -1.0)) x) y)))))
double code(double x, double y) {
double tmp;
if (y <= -1200000000000.0) {
tmp = x - ((x - 1.0) / y);
} else if (y <= 240000000.0) {
tmp = fma((((y / (1.0 + y)) * (1.0 - x)) / (y - 1.0)), -(y - 1.0), 1.0);
} else {
tmp = x - (((1.0 - pow(x, -1.0)) * x) / y);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= -1200000000000.0) tmp = Float64(x - Float64(Float64(x - 1.0) / y)); elseif (y <= 240000000.0) tmp = fma(Float64(Float64(Float64(y / Float64(1.0 + y)) * Float64(1.0 - x)) / Float64(y - 1.0)), Float64(-Float64(y - 1.0)), 1.0); else tmp = Float64(x - Float64(Float64(Float64(1.0 - (x ^ -1.0)) * x) / y)); end return tmp end
code[x_, y_] := If[LessEqual[y, -1200000000000.0], N[(x - N[(N[(x - 1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 240000000.0], N[(N[(N[(N[(y / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] * N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / N[(y - 1.0), $MachinePrecision]), $MachinePrecision] * (-N[(y - 1.0), $MachinePrecision]) + 1.0), $MachinePrecision], N[(x - N[(N[(N[(1.0 - N[Power[x, -1.0], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1200000000000:\\
\;\;\;\;x - \frac{x - 1}{y}\\
\mathbf{elif}\;y \leq 240000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{y}{1 + y} \cdot \left(1 - x\right)}{y - 1}, -\left(y - 1\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\left(1 - {x}^{-1}\right) \cdot x}{y}\\
\end{array}
\end{array}
if y < -1.2e12Initial program 23.5%
Taylor expanded in y around inf
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate--r-N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64100.0
Applied rewrites100.0%
if -1.2e12 < y < 2.4e8Initial program 99.9%
lift--.f64N/A
*-lft-identityN/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/A
*-lft-identityN/A
+-commutativeN/A
lift-/.f64N/A
lift-+.f64N/A
flip-+N/A
associate-/r/N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
Applied rewrites99.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-fma.f64N/A
difference-of-sqr--1N/A
lift-+.f64N/A
lift--.f64N/A
associate-/r*N/A
lift--.f64N/A
lift-+.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
if 2.4e8 < y Initial program 31.9%
Taylor expanded in y around inf
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate--r-N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in x around inf
Applied rewrites100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= y -125000000000.0)
(- x (/ (- x 1.0) y))
(if (<= y 410000000.0)
(fma y (/ (- x 1.0) (- y -1.0)) 1.0)
(- x (/ (* (- 1.0 (pow x -1.0)) x) y)))))
double code(double x, double y) {
double tmp;
if (y <= -125000000000.0) {
tmp = x - ((x - 1.0) / y);
} else if (y <= 410000000.0) {
tmp = fma(y, ((x - 1.0) / (y - -1.0)), 1.0);
} else {
tmp = x - (((1.0 - pow(x, -1.0)) * x) / y);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= -125000000000.0) tmp = Float64(x - Float64(Float64(x - 1.0) / y)); elseif (y <= 410000000.0) tmp = fma(y, Float64(Float64(x - 1.0) / Float64(y - -1.0)), 1.0); else tmp = Float64(x - Float64(Float64(Float64(1.0 - (x ^ -1.0)) * x) / y)); end return tmp end
code[x_, y_] := If[LessEqual[y, -125000000000.0], N[(x - N[(N[(x - 1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 410000000.0], N[(y * N[(N[(x - 1.0), $MachinePrecision] / N[(y - -1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(x - N[(N[(N[(1.0 - N[Power[x, -1.0], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -125000000000:\\
\;\;\;\;x - \frac{x - 1}{y}\\
\mathbf{elif}\;y \leq 410000000:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x - 1}{y - -1}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\left(1 - {x}^{-1}\right) \cdot x}{y}\\
\end{array}
\end{array}
if y < -1.25e11Initial program 24.8%
Taylor expanded in y around inf
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate--r-N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64100.0
Applied rewrites100.0%
if -1.25e11 < y < 4.1e8Initial program 99.9%
Taylor expanded in y around inf
lower--.f644.4
Applied rewrites4.4%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
associate-/l*N/A
distribute-rgt-outN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-inN/A
distribute-neg-inN/A
mul-1-negN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites99.9%
Applied rewrites99.9%
if 4.1e8 < y Initial program 31.9%
Taylor expanded in y around inf
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate--r-N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in x around inf
Applied rewrites100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* (- 1.0 x) y) (- y -1.0))) (t_1 (- 1.0 (- x))))
(if (<= t_0 -4e+153)
t_1
(if (<= t_0 -10000.0)
(* y x)
(if (<= t_0 1.02) 1.0 (if (<= t_0 2e+201) (* y x) t_1))))))
double code(double x, double y) {
double t_0 = ((1.0 - x) * y) / (y - -1.0);
double t_1 = 1.0 - -x;
double tmp;
if (t_0 <= -4e+153) {
tmp = t_1;
} else if (t_0 <= -10000.0) {
tmp = y * x;
} else if (t_0 <= 1.02) {
tmp = 1.0;
} else if (t_0 <= 2e+201) {
tmp = y * x;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ((1.0d0 - x) * y) / (y - (-1.0d0))
t_1 = 1.0d0 - -x
if (t_0 <= (-4d+153)) then
tmp = t_1
else if (t_0 <= (-10000.0d0)) then
tmp = y * x
else if (t_0 <= 1.02d0) then
tmp = 1.0d0
else if (t_0 <= 2d+201) then
tmp = y * x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = ((1.0 - x) * y) / (y - -1.0);
double t_1 = 1.0 - -x;
double tmp;
if (t_0 <= -4e+153) {
tmp = t_1;
} else if (t_0 <= -10000.0) {
tmp = y * x;
} else if (t_0 <= 1.02) {
tmp = 1.0;
} else if (t_0 <= 2e+201) {
tmp = y * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y): t_0 = ((1.0 - x) * y) / (y - -1.0) t_1 = 1.0 - -x tmp = 0 if t_0 <= -4e+153: tmp = t_1 elif t_0 <= -10000.0: tmp = y * x elif t_0 <= 1.02: tmp = 1.0 elif t_0 <= 2e+201: tmp = y * x else: tmp = t_1 return tmp
function code(x, y) t_0 = Float64(Float64(Float64(1.0 - x) * y) / Float64(y - -1.0)) t_1 = Float64(1.0 - Float64(-x)) tmp = 0.0 if (t_0 <= -4e+153) tmp = t_1; elseif (t_0 <= -10000.0) tmp = Float64(y * x); elseif (t_0 <= 1.02) tmp = 1.0; elseif (t_0 <= 2e+201) tmp = Float64(y * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y) t_0 = ((1.0 - x) * y) / (y - -1.0); t_1 = 1.0 - -x; tmp = 0.0; if (t_0 <= -4e+153) tmp = t_1; elseif (t_0 <= -10000.0) tmp = y * x; elseif (t_0 <= 1.02) tmp = 1.0; elseif (t_0 <= 2e+201) tmp = y * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(y - -1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - (-x)), $MachinePrecision]}, If[LessEqual[t$95$0, -4e+153], t$95$1, If[LessEqual[t$95$0, -10000.0], N[(y * x), $MachinePrecision], If[LessEqual[t$95$0, 1.02], 1.0, If[LessEqual[t$95$0, 2e+201], N[(y * x), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(1 - x\right) \cdot y}{y - -1}\\
t_1 := 1 - \left(-x\right)\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{+153}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq -10000:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;t\_0 \leq 1.02:\\
\;\;\;\;1\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+201}:\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < -4e153 or 2.00000000000000008e201 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) Initial program 34.4%
Taylor expanded in y around inf
lower--.f6487.5
Applied rewrites87.5%
Taylor expanded in x around inf
Applied rewrites87.5%
if -4e153 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < -1e4 or 1.02 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 2.00000000000000008e201Initial program 99.7%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6461.2
Applied rewrites61.2%
Taylor expanded in x around inf
Applied rewrites59.0%
if -1e4 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 1.02Initial program 61.7%
lift--.f64N/A
*-lft-identityN/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/A
*-lft-identityN/A
+-commutativeN/A
lift-/.f64N/A
lift-+.f64N/A
flip-+N/A
associate-/r/N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
Applied rewrites60.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-fma.f64N/A
difference-of-sqr--1N/A
lift-+.f64N/A
lift--.f64N/A
associate-/r*N/A
lift--.f64N/A
lift-+.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6461.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6461.5
Applied rewrites61.5%
Taylor expanded in y around 0
Applied rewrites58.7%
Final simplification64.3%
(FPCore (x y) :precision binary64 (let* ((t_0 (- 1.0 (/ (* (- 1.0 x) y) (- y -1.0))))) (if (or (<= t_0 -0.02) (not (<= t_0 50.0))) (* y x) 1.0)))
double code(double x, double y) {
double t_0 = 1.0 - (((1.0 - x) * y) / (y - -1.0));
double tmp;
if ((t_0 <= -0.02) || !(t_0 <= 50.0)) {
tmp = y * x;
} else {
tmp = 1.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 - (((1.0d0 - x) * y) / (y - (-1.0d0)))
if ((t_0 <= (-0.02d0)) .or. (.not. (t_0 <= 50.0d0))) then
tmp = y * x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 - (((1.0 - x) * y) / (y - -1.0));
double tmp;
if ((t_0 <= -0.02) || !(t_0 <= 50.0)) {
tmp = y * x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 - (((1.0 - x) * y) / (y - -1.0)) tmp = 0 if (t_0 <= -0.02) or not (t_0 <= 50.0): tmp = y * x else: tmp = 1.0 return tmp
function code(x, y) t_0 = Float64(1.0 - Float64(Float64(Float64(1.0 - x) * y) / Float64(y - -1.0))) tmp = 0.0 if ((t_0 <= -0.02) || !(t_0 <= 50.0)) tmp = Float64(y * x); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 - (((1.0 - x) * y) / (y - -1.0)); tmp = 0.0; if ((t_0 <= -0.02) || ~((t_0 <= 50.0))) tmp = y * x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(y - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -0.02], N[Not[LessEqual[t$95$0, 50.0]], $MachinePrecision]], N[(y * x), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{\left(1 - x\right) \cdot y}{y - -1}\\
\mathbf{if}\;t\_0 \leq -0.02 \lor \neg \left(t\_0 \leq 50\right):\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64)))) < -0.0200000000000000004 or 50 < (-.f64 #s(literal 1 binary64) (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64)))) Initial program 69.8%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6439.8
Applied rewrites39.8%
Taylor expanded in x around inf
Applied rewrites38.5%
if -0.0200000000000000004 < (-.f64 #s(literal 1 binary64) (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64)))) < 50Initial program 61.7%
lift--.f64N/A
*-lft-identityN/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/A
*-lft-identityN/A
+-commutativeN/A
lift-/.f64N/A
lift-+.f64N/A
flip-+N/A
associate-/r/N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
Applied rewrites60.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-fma.f64N/A
difference-of-sqr--1N/A
lift-+.f64N/A
lift--.f64N/A
associate-/r*N/A
lift--.f64N/A
lift-+.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6461.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6461.5
Applied rewrites61.5%
Taylor expanded in y around 0
Applied rewrites58.7%
Final simplification50.3%
(FPCore (x y) :precision binary64 (if (or (<= y -125000000000.0) (not (<= y 410000000.0))) (- x (/ (- x 1.0) y)) (fma y (/ (- x 1.0) (- y -1.0)) 1.0)))
double code(double x, double y) {
double tmp;
if ((y <= -125000000000.0) || !(y <= 410000000.0)) {
tmp = x - ((x - 1.0) / y);
} else {
tmp = fma(y, ((x - 1.0) / (y - -1.0)), 1.0);
}
return tmp;
}
function code(x, y) tmp = 0.0 if ((y <= -125000000000.0) || !(y <= 410000000.0)) tmp = Float64(x - Float64(Float64(x - 1.0) / y)); else tmp = fma(y, Float64(Float64(x - 1.0) / Float64(y - -1.0)), 1.0); end return tmp end
code[x_, y_] := If[Or[LessEqual[y, -125000000000.0], N[Not[LessEqual[y, 410000000.0]], $MachinePrecision]], N[(x - N[(N[(x - 1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(x - 1.0), $MachinePrecision] / N[(y - -1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -125000000000 \lor \neg \left(y \leq 410000000\right):\\
\;\;\;\;x - \frac{x - 1}{y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x - 1}{y - -1}, 1\right)\\
\end{array}
\end{array}
if y < -1.25e11 or 4.1e8 < y Initial program 28.6%
Taylor expanded in y around inf
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate--r-N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64100.0
Applied rewrites100.0%
if -1.25e11 < y < 4.1e8Initial program 99.9%
Taylor expanded in y around inf
lower--.f644.4
Applied rewrites4.4%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
associate-/l*N/A
distribute-rgt-outN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-inN/A
distribute-neg-inN/A
mul-1-negN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
Applied rewrites99.9%
Applied rewrites99.9%
Final simplification100.0%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (- x (/ (- x 1.0) y)) (fma (fma (- 1.0 x) y (- x 1.0)) y 1.0)))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = x - ((x - 1.0) / y);
} else {
tmp = fma(fma((1.0 - x), y, (x - 1.0)), y, 1.0);
}
return tmp;
}
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.0)) tmp = Float64(x - Float64(Float64(x - 1.0) / y)); else tmp = fma(fma(Float64(1.0 - x), y, Float64(x - 1.0)), y, 1.0); end return tmp end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(x - N[(N[(x - 1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - x), $MachinePrecision] * y + N[(x - 1.0), $MachinePrecision]), $MachinePrecision] * y + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;x - \frac{x - 1}{y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(1 - x, y, x - 1\right), y, 1\right)\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 30.2%
Taylor expanded in y around inf
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate--r-N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6499.4
Applied rewrites99.4%
if -1 < y < 1Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower--.f6498.6
Applied rewrites98.6%
Final simplification99.0%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (- x (/ (- x 1.0) y)) (fma (- x 1.0) y 1.0)))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = x - ((x - 1.0) / y);
} else {
tmp = fma((x - 1.0), y, 1.0);
}
return tmp;
}
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.0)) tmp = Float64(x - Float64(Float64(x - 1.0) / y)); else tmp = fma(Float64(x - 1.0), y, 1.0); end return tmp end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(x - N[(N[(x - 1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(x - 1.0), $MachinePrecision] * y + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;x - \frac{x - 1}{y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - 1, y, 1\right)\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 30.2%
Taylor expanded in y around inf
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate--r-N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6499.4
Applied rewrites99.4%
if -1 < y < 1Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6498.0
Applied rewrites98.0%
Final simplification98.7%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 0.83))) (- x (/ -1.0 y)) (fma (- x 1.0) y 1.0)))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 0.83)) {
tmp = x - (-1.0 / y);
} else {
tmp = fma((x - 1.0), y, 1.0);
}
return tmp;
}
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 0.83)) tmp = Float64(x - Float64(-1.0 / y)); else tmp = fma(Float64(x - 1.0), y, 1.0); end return tmp end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 0.83]], $MachinePrecision]], N[(x - N[(-1.0 / y), $MachinePrecision]), $MachinePrecision], N[(N[(x - 1.0), $MachinePrecision] * y + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 0.83\right):\\
\;\;\;\;x - \frac{-1}{y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - 1, y, 1\right)\\
\end{array}
\end{array}
if y < -1 or 0.82999999999999996 < y Initial program 30.2%
Taylor expanded in y around inf
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate--r-N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6499.4
Applied rewrites99.4%
Taylor expanded in x around 0
Applied rewrites98.3%
if -1 < y < 0.82999999999999996Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6498.0
Applied rewrites98.0%
Final simplification98.2%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.08))) (- x (/ x y)) (fma (- x 1.0) y 1.0)))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.08)) {
tmp = x - (x / y);
} else {
tmp = fma((x - 1.0), y, 1.0);
}
return tmp;
}
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.08)) tmp = Float64(x - Float64(x / y)); else tmp = fma(Float64(x - 1.0), y, 1.0); end return tmp end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.08]], $MachinePrecision]], N[(x - N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(x - 1.0), $MachinePrecision] * y + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1.08\right):\\
\;\;\;\;x - \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - 1, y, 1\right)\\
\end{array}
\end{array}
if y < -1 or 1.0800000000000001 < y Initial program 30.2%
Taylor expanded in y around inf
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate--r-N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6499.4
Applied rewrites99.4%
Taylor expanded in x around inf
Applied rewrites80.1%
if -1 < y < 1.0800000000000001Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6498.0
Applied rewrites98.0%
Final simplification89.1%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (- 1.0 (- 1.0 x)) (fma (- x 1.0) y 1.0)))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = 1.0 - (1.0 - x);
} else {
tmp = fma((x - 1.0), y, 1.0);
}
return tmp;
}
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.0)) tmp = Float64(1.0 - Float64(1.0 - x)); else tmp = fma(Float64(x - 1.0), y, 1.0); end return tmp end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(1.0 - N[(1.0 - x), $MachinePrecision]), $MachinePrecision], N[(N[(x - 1.0), $MachinePrecision] * y + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;1 - \left(1 - x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - 1, y, 1\right)\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 30.2%
Taylor expanded in y around inf
lower--.f6453.7
Applied rewrites53.7%
if -1 < y < 1Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6498.0
Applied rewrites98.0%
Final simplification75.9%
(FPCore (x y) :precision binary64 1.0)
double code(double x, double y) {
return 1.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0
end function
public static double code(double x, double y) {
return 1.0;
}
def code(x, y): return 1.0
function code(x, y) return 1.0 end
function tmp = code(x, y) tmp = 1.0; end
code[x_, y_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 65.1%
lift--.f64N/A
*-lft-identityN/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/A
*-lft-identityN/A
+-commutativeN/A
lift-/.f64N/A
lift-+.f64N/A
flip-+N/A
associate-/r/N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
Applied rewrites64.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-fma.f64N/A
difference-of-sqr--1N/A
lift-+.f64N/A
lift--.f64N/A
associate-/r*N/A
lift--.f64N/A
lift-+.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6477.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6477.5
Applied rewrites77.5%
Taylor expanded in y around 0
Applied rewrites35.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 2024332
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, D"
:precision binary64
:alt
(! :herbie-platform default (if (< y -36938482788297247/10000000000000) (- (/ 1 y) (- (/ x y) x)) (if (< y 679931050341891/100000) (- 1 (/ (* (- 1 x) y) (+ y 1))) (- (/ 1 y) (- (/ x y) x)))))
(- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))