
(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 -12500.0)
(+
x
(fma
(/ 1.0 y)
(- (+ 1.0 (- t_0 x)) (/ x (* y y)))
(/ 1.0 (* y (* y y)))))
(if (<= y 240000.0)
(+ 1.0 (/ (* y (- 1.0 x)) (- -1.0 y)))
(fma t_0 (+ (/ 1.0 y) -1.0) x)))))
double code(double x, double y) {
double t_0 = (x + -1.0) / y;
double tmp;
if (y <= -12500.0) {
tmp = x + fma((1.0 / y), ((1.0 + (t_0 - x)) - (x / (y * y))), (1.0 / (y * (y * y))));
} else if (y <= 240000.0) {
tmp = 1.0 + ((y * (1.0 - x)) / (-1.0 - y));
} else {
tmp = fma(t_0, ((1.0 / y) + -1.0), x);
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(x + -1.0) / y) tmp = 0.0 if (y <= -12500.0) tmp = Float64(x + fma(Float64(1.0 / y), Float64(Float64(1.0 + Float64(t_0 - x)) - Float64(x / Float64(y * y))), Float64(1.0 / Float64(y * Float64(y * y))))); elseif (y <= 240000.0) tmp = Float64(1.0 + Float64(Float64(y * Float64(1.0 - x)) / Float64(-1.0 - y))); else tmp = fma(t_0, Float64(Float64(1.0 / y) + -1.0), x); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[y, -12500.0], N[(x + N[(N[(1.0 / y), $MachinePrecision] * N[(N[(1.0 + N[(t$95$0 - x), $MachinePrecision]), $MachinePrecision] - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(y * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 240000.0], N[(1.0 + N[(N[(y * N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[(1.0 / y), $MachinePrecision] + -1.0), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + -1}{y}\\
\mathbf{if}\;y \leq -12500:\\
\;\;\;\;x + \mathsf{fma}\left(\frac{1}{y}, \left(1 + \left(t\_0 - x\right)\right) - \frac{x}{y \cdot y}, \frac{1}{y \cdot \left(y \cdot y\right)}\right)\\
\mathbf{elif}\;y \leq 240000:\\
\;\;\;\;1 + \frac{y \cdot \left(1 - x\right)}{-1 - y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, \frac{1}{y} + -1, x\right)\\
\end{array}
\end{array}
if y < -12500Initial program 24.8%
Taylor expanded in y around inf
Simplified100.0%
if -12500 < y < 2.4e5Initial program 100.0%
if 2.4e5 < y Initial program 31.5%
Taylor expanded in y around inf
associate--l+N/A
+-commutativeN/A
Simplified100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (fma (/ (+ x -1.0) y) (+ (/ 1.0 y) -1.0) x)))
(if (<= y -12500.0)
(+ x (/ (- 1.0 t_0) y))
(if (<= y 240000.0) (+ 1.0 (/ (* y (- 1.0 x)) (- -1.0 y))) t_0))))
double code(double x, double y) {
double t_0 = fma(((x + -1.0) / y), ((1.0 / y) + -1.0), x);
double tmp;
if (y <= -12500.0) {
tmp = x + ((1.0 - t_0) / y);
} else if (y <= 240000.0) {
tmp = 1.0 + ((y * (1.0 - x)) / (-1.0 - y));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y) t_0 = fma(Float64(Float64(x + -1.0) / y), Float64(Float64(1.0 / y) + -1.0), x) tmp = 0.0 if (y <= -12500.0) tmp = Float64(x + Float64(Float64(1.0 - t_0) / y)); elseif (y <= 240000.0) tmp = Float64(1.0 + Float64(Float64(y * Float64(1.0 - x)) / Float64(-1.0 - y))); else tmp = t_0; end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision] * N[(N[(1.0 / y), $MachinePrecision] + -1.0), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -12500.0], N[(x + N[(N[(1.0 - t$95$0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 240000.0], N[(1.0 + N[(N[(y * N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{x + -1}{y}, \frac{1}{y} + -1, x\right)\\
\mathbf{if}\;y \leq -12500:\\
\;\;\;\;x + \frac{1 - t\_0}{y}\\
\mathbf{elif}\;y \leq 240000:\\
\;\;\;\;1 + \frac{y \cdot \left(1 - x\right)}{-1 - y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -12500Initial program 24.8%
Taylor expanded in y around -inf
Simplified100.0%
if -12500 < y < 2.4e5Initial program 100.0%
if 2.4e5 < y Initial program 31.5%
Taylor expanded in y around inf
associate--l+N/A
+-commutativeN/A
Simplified100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (fma (/ (+ x -1.0) y) (+ (/ 1.0 y) -1.0) x)))
(if (<= y -320000.0)
t_0
(if (<= y 240000.0) (+ 1.0 (/ (* y (- 1.0 x)) (- -1.0 y))) t_0))))
double code(double x, double y) {
double t_0 = fma(((x + -1.0) / y), ((1.0 / y) + -1.0), x);
double tmp;
if (y <= -320000.0) {
tmp = t_0;
} else if (y <= 240000.0) {
tmp = 1.0 + ((y * (1.0 - x)) / (-1.0 - y));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y) t_0 = fma(Float64(Float64(x + -1.0) / y), Float64(Float64(1.0 / y) + -1.0), x) tmp = 0.0 if (y <= -320000.0) tmp = t_0; elseif (y <= 240000.0) tmp = Float64(1.0 + Float64(Float64(y * Float64(1.0 - x)) / Float64(-1.0 - y))); else tmp = t_0; end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision] * N[(N[(1.0 / y), $MachinePrecision] + -1.0), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -320000.0], t$95$0, If[LessEqual[y, 240000.0], N[(1.0 + N[(N[(y * N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{x + -1}{y}, \frac{1}{y} + -1, x\right)\\
\mathbf{if}\;y \leq -320000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 240000:\\
\;\;\;\;1 + \frac{y \cdot \left(1 - x\right)}{-1 - y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -3.2e5 or 2.4e5 < y Initial program 27.8%
Taylor expanded in y around inf
associate--l+N/A
+-commutativeN/A
Simplified99.9%
if -3.2e5 < y < 2.4e5Initial program 100.0%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ x (/ (- 1.0 x) y))))
(if (<= y -195000000.0)
t_0
(if (<= y 145000000.0) (fma y (/ (- 1.0 x) (- -1.0 y)) 1.0) t_0))))
double code(double x, double y) {
double t_0 = x + ((1.0 - x) / y);
double tmp;
if (y <= -195000000.0) {
tmp = t_0;
} else if (y <= 145000000.0) {
tmp = fma(y, ((1.0 - x) / (-1.0 - y)), 1.0);
} 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 <= -195000000.0) tmp = t_0; elseif (y <= 145000000.0) tmp = fma(y, Float64(Float64(1.0 - x) / Float64(-1.0 - y)), 1.0); else tmp = t_0; end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -195000000.0], t$95$0, If[LessEqual[y, 145000000.0], N[(y * N[(N[(1.0 - x), $MachinePrecision] / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \frac{1 - x}{y}\\
\mathbf{if}\;y \leq -195000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 145000000:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{1 - x}{-1 - y}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.95e8 or 1.45e8 < y Initial program 27.5%
Taylor expanded in y around inf
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate--r-N/A
div-subN/A
unsub-negN/A
mul-1-negN/A
lower-+.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
neg-sub0N/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
lower--.f6499.5
Simplified99.5%
if -1.95e8 < y < 1.45e8Initial program 99.7%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
*-lft-identityN/A
cancel-sign-sub-invN/A
metadata-evalN/A
neg-mul-1N/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied egg-rr99.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ x (/ (- 1.0 x) y))))
(if (<= y -1.0)
t_0
(if (<= y 1.0) (fma (- y (* y x)) (+ y -1.0) 1.0) 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 <= 1.0) {
tmp = fma((y - (y * x)), (y + -1.0), 1.0);
} 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 <= 1.0) tmp = fma(Float64(y - Float64(y * x)), Float64(y + -1.0), 1.0); else tmp = t_0; end return 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, 1.0], N[(N[(y - N[(y * x), $MachinePrecision]), $MachinePrecision] * N[(y + -1.0), $MachinePrecision] + 1.0), $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 1:\\
\;\;\;\;\mathsf{fma}\left(y - y \cdot x, y + -1, 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 27.8%
Taylor expanded in y around inf
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate--r-N/A
div-subN/A
unsub-negN/A
mul-1-negN/A
lower-+.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
neg-sub0N/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
lower--.f6499.1
Simplified99.1%
if -1 < y < 1Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
+-commutativeN/A
associate--l+N/A
distribute-rgt-inN/A
*-commutativeN/A
*-rgt-identityN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-outN/A
neg-sub0N/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
distribute-lft-outN/A
lower-fma.f64N/A
Simplified98.1%
(FPCore (x y) :precision binary64 (let* ((t_0 (+ x (/ (- 1.0 x) y)))) (if (<= y -1.0) t_0 (if (<= y 1.0) (fma y (+ x -1.0) 1.0) 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 <= 1.0) {
tmp = fma(y, (x + -1.0), 1.0);
} 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 <= 1.0) tmp = fma(y, Float64(x + -1.0), 1.0); else tmp = t_0; end return 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, 1.0], N[(y * N[(x + -1.0), $MachinePrecision] + 1.0), $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 1:\\
\;\;\;\;\mathsf{fma}\left(y, x + -1, 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 27.8%
Taylor expanded in y around inf
+-commutativeN/A
associate--l+N/A
+-commutativeN/A
associate--r-N/A
div-subN/A
unsub-negN/A
mul-1-negN/A
lower-+.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
neg-sub0N/A
associate-+l-N/A
neg-sub0N/A
+-commutativeN/A
sub-negN/A
lower--.f6499.1
Simplified99.1%
if -1 < y < 1Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f6497.7
Simplified97.7%
(FPCore (x y) :precision binary64 (if (<= y -1.0) (- x (/ x y)) (if (<= y 1.0) (fma y (+ x -1.0) 1.0) x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x - (x / y);
} else if (y <= 1.0) {
tmp = fma(y, (x + -1.0), 1.0);
} else {
tmp = x;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = Float64(x - Float64(x / y)); elseif (y <= 1.0) tmp = fma(y, Float64(x + -1.0), 1.0); else tmp = x; end return tmp end
code[x_, y_] := If[LessEqual[y, -1.0], N[(x - N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(y * N[(x + -1.0), $MachinePrecision] + 1.0), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x - \frac{x}{y}\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;\mathsf{fma}\left(y, x + -1, 1\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1Initial program 24.8%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6478.8
Simplified78.8%
Taylor expanded in y around inf
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6478.9
Simplified78.9%
if -1 < y < 1Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f6497.7
Simplified97.7%
if 1 < y Initial program 31.5%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
*-lft-identityN/A
cancel-sign-sub-invN/A
metadata-evalN/A
neg-mul-1N/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied egg-rr63.8%
Taylor expanded in y around inf
mul-1-negN/A
unsub-negN/A
associate--r-N/A
metadata-evalN/A
+-lft-identity82.2
Simplified82.2%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 1.0) (fma y (+ x -1.0) 1.0) x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 1.0) {
tmp = fma(y, (x + -1.0), 1.0);
} else {
tmp = x;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 1.0) tmp = fma(y, Float64(x + -1.0), 1.0); else tmp = x; end return tmp end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 1.0], N[(y * N[(x + -1.0), $MachinePrecision] + 1.0), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;\mathsf{fma}\left(y, x + -1, 1\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 27.8%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
*-lft-identityN/A
cancel-sign-sub-invN/A
metadata-evalN/A
neg-mul-1N/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied egg-rr59.0%
Taylor expanded in y around inf
mul-1-negN/A
unsub-negN/A
associate--r-N/A
metadata-evalN/A
+-lft-identity80.3
Simplified80.3%
if -1 < y < 1Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f6497.7
Simplified97.7%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 2.7e-17) (fma y y (- 1.0 y)) x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 2.7e-17) {
tmp = fma(y, y, (1.0 - y));
} else {
tmp = x;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 2.7e-17) tmp = fma(y, y, Float64(1.0 - y)); else tmp = x; end return tmp end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 2.7e-17], N[(y * y + N[(1.0 - y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{-17}:\\
\;\;\;\;\mathsf{fma}\left(y, y, 1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 2.7000000000000001e-17 < y Initial program 29.4%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
*-lft-identityN/A
cancel-sign-sub-invN/A
metadata-evalN/A
neg-mul-1N/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied egg-rr59.9%
Taylor expanded in y around inf
mul-1-negN/A
unsub-negN/A
associate--r-N/A
metadata-evalN/A
+-lft-identity78.9
Simplified78.9%
if -1 < y < 2.7000000000000001e-17Initial program 100.0%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6473.0
Simplified73.0%
Taylor expanded in y around 0
+-commutativeN/A
sub-negN/A
metadata-evalN/A
distribute-rgt-inN/A
unpow2N/A
associate-+l+N/A
unpow2N/A
+-commutativeN/A
lower-fma.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6472.3
Simplified72.3%
(FPCore (x y) :precision binary64 (if (<= y -2.3e-7) x (if (<= y -1.26e-55) (* y x) (if (<= y 2.7e-17) 1.0 x))))
double code(double x, double y) {
double tmp;
if (y <= -2.3e-7) {
tmp = x;
} else if (y <= -1.26e-55) {
tmp = y * x;
} else if (y <= 2.7e-17) {
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-7)) then
tmp = x
else if (y <= (-1.26d-55)) then
tmp = y * x
else if (y <= 2.7d-17) 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-7) {
tmp = x;
} else if (y <= -1.26e-55) {
tmp = y * x;
} else if (y <= 2.7e-17) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.3e-7: tmp = x elif y <= -1.26e-55: tmp = y * x elif y <= 2.7e-17: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -2.3e-7) tmp = x; elseif (y <= -1.26e-55) tmp = Float64(y * x); elseif (y <= 2.7e-17) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2.3e-7) tmp = x; elseif (y <= -1.26e-55) tmp = y * x; elseif (y <= 2.7e-17) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.3e-7], x, If[LessEqual[y, -1.26e-55], N[(y * x), $MachinePrecision], If[LessEqual[y, 2.7e-17], 1.0, x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{-7}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1.26 \cdot 10^{-55}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{-17}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.29999999999999995e-7 or 2.7000000000000001e-17 < y Initial program 30.8%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
*-lft-identityN/A
cancel-sign-sub-invN/A
metadata-evalN/A
neg-mul-1N/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied egg-rr60.7%
Taylor expanded in y around inf
mul-1-negN/A
unsub-negN/A
associate--r-N/A
metadata-evalN/A
+-lft-identity77.3
Simplified77.3%
if -2.29999999999999995e-7 < y < -1.2599999999999999e-55Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f64100.0
Simplified100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6488.6
Simplified88.6%
if -1.2599999999999999e-55 < y < 2.7000000000000001e-17Initial program 100.0%
Taylor expanded in y around 0
Simplified76.7%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 2.7e-17) (- 1.0 y) x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 2.7e-17) {
tmp = 1.0 - y;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.0d0)) then
tmp = x
else if (y <= 2.7d-17) then
tmp = 1.0d0 - y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 2.7e-17) {
tmp = 1.0 - y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 2.7e-17: tmp = 1.0 - y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 2.7e-17) tmp = Float64(1.0 - y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = x; elseif (y <= 2.7e-17) tmp = 1.0 - y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 2.7e-17], N[(1.0 - y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{-17}:\\
\;\;\;\;1 - y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 2.7000000000000001e-17 < y Initial program 29.4%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
*-lft-identityN/A
cancel-sign-sub-invN/A
metadata-evalN/A
neg-mul-1N/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied egg-rr59.9%
Taylor expanded in y around inf
mul-1-negN/A
unsub-negN/A
associate--r-N/A
metadata-evalN/A
+-lft-identity78.9
Simplified78.9%
if -1 < y < 2.7000000000000001e-17Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f6499.0
Simplified99.0%
Taylor expanded in x around 0
mul-1-negN/A
unsub-negN/A
lower--.f6471.9
Simplified71.9%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 2.7e-17) 1.0 x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 2.7e-17) {
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 <= 2.7d-17) 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 <= 2.7e-17) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 2.7e-17: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 2.7e-17) 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 <= 2.7e-17) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 2.7e-17], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{-17}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 2.7000000000000001e-17 < y Initial program 29.4%
lift--.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
*-lft-identityN/A
cancel-sign-sub-invN/A
metadata-evalN/A
neg-mul-1N/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
Applied egg-rr59.9%
Taylor expanded in y around inf
mul-1-negN/A
unsub-negN/A
associate--r-N/A
metadata-evalN/A
+-lft-identity78.9
Simplified78.9%
if -1 < y < 2.7000000000000001e-17Initial program 100.0%
Taylor expanded in y around 0
Simplified71.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 61.4%
Taylor expanded in y around 0
Simplified34.2%
(FPCore (x y) :precision binary64 0.0)
double code(double x, double y) {
return 0.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 0.0d0
end function
public static double code(double x, double y) {
return 0.0;
}
def code(x, y): return 0.0
function code(x, y) return 0.0 end
function tmp = code(x, y) tmp = 0.0; end
code[x_, y_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 61.4%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6435.5
Simplified35.5%
Taylor expanded in y around inf
Simplified3.1%
metadata-eval3.1
Applied egg-rr3.1%
(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 2024208
(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))))