
(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 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))
double code(double x, double y) {
return 1.0 - (((1.0 - x) * y) / (y + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 - (((1.0d0 - x) * y) / (y + 1.0d0))
end function
public static double code(double x, double y) {
return 1.0 - (((1.0 - x) * y) / (y + 1.0));
}
def code(x, y): return 1.0 - (((1.0 - x) * y) / (y + 1.0))
function code(x, y) return Float64(1.0 - Float64(Float64(Float64(1.0 - x) * y) / Float64(y + 1.0))) end
function tmp = code(x, y) tmp = 1.0 - (((1.0 - x) * y) / (y + 1.0)); end
code[x_, y_] := N[(1.0 - N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{\left(1 - x\right) \cdot y}{y + 1}
\end{array}
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (- 1.0 x) (* y y))))
(if (<= y -205000.0)
(+ (/ 1.0 y) (- (fma -1.0 t_0 x) (/ x y)))
(if (<= y 320000.0)
(+ 1.0 (* y (/ (+ -1.0 x) (+ y 1.0))))
(+ (- x t_0) (/ (- 1.0 x) y))))))
double code(double x, double y) {
double t_0 = (1.0 - x) / (y * y);
double tmp;
if (y <= -205000.0) {
tmp = (1.0 / y) + (fma(-1.0, t_0, x) - (x / y));
} else if (y <= 320000.0) {
tmp = 1.0 + (y * ((-1.0 + x) / (y + 1.0)));
} else {
tmp = (x - t_0) + ((1.0 - x) / y);
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(1.0 - x) / Float64(y * y)) tmp = 0.0 if (y <= -205000.0) tmp = Float64(Float64(1.0 / y) + Float64(fma(-1.0, t_0, x) - Float64(x / y))); elseif (y <= 320000.0) tmp = Float64(1.0 + Float64(y * Float64(Float64(-1.0 + x) / Float64(y + 1.0)))); else tmp = Float64(Float64(x - t_0) + Float64(Float64(1.0 - x) / y)); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(1.0 - x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -205000.0], N[(N[(1.0 / y), $MachinePrecision] + N[(N[(-1.0 * t$95$0 + x), $MachinePrecision] - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 320000.0], N[(1.0 + N[(y * N[(N[(-1.0 + x), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - t$95$0), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1 - x}{y \cdot y}\\
\mathbf{if}\;y \leq -205000:\\
\;\;\;\;\frac{1}{y} + \left(\mathsf{fma}\left(-1, t_0, x\right) - \frac{x}{y}\right)\\
\mathbf{elif}\;y \leq 320000:\\
\;\;\;\;1 + y \cdot \frac{-1 + x}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(x - t_0\right) + \frac{1 - x}{y}\\
\end{array}
\end{array}
if y < -205000Initial program 27.0%
sub-neg27.0%
distribute-neg-frac27.0%
neg-mul-127.0%
associate-*l/26.6%
metadata-eval26.6%
associate-*l/26.6%
associate-/r/26.6%
metadata-eval26.6%
distribute-neg-frac26.6%
cancel-sign-sub-inv26.6%
associate-/r/27.0%
associate-/r*27.0%
neg-mul-127.0%
associate-/r/26.6%
distribute-rgt-neg-in26.6%
associate-/r/27.0%
distribute-neg-frac27.0%
metadata-eval27.0%
associate-/r/26.6%
Simplified55.3%
Taylor expanded in y around inf 100.0%
associate--l+100.0%
fma-def100.0%
neg-mul-1100.0%
sub-neg100.0%
unpow2100.0%
Simplified100.0%
if -205000 < y < 3.2e5Initial program 99.9%
sub-neg99.9%
distribute-neg-frac99.9%
neg-mul-199.9%
associate-*l/99.9%
metadata-eval99.9%
associate-*l/99.9%
associate-/r/99.9%
metadata-eval99.9%
distribute-neg-frac99.9%
cancel-sign-sub-inv99.9%
associate-/r/99.9%
associate-/r*99.9%
neg-mul-199.9%
associate-/r/99.9%
distribute-rgt-neg-in99.9%
associate-/r/99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
associate-/r/99.9%
Simplified99.9%
if 3.2e5 < y Initial program 34.2%
sub-neg34.2%
distribute-neg-frac34.2%
neg-mul-134.2%
associate-*l/34.4%
metadata-eval34.4%
associate-*l/34.4%
associate-/r/34.4%
metadata-eval34.4%
distribute-neg-frac34.4%
cancel-sign-sub-inv34.4%
associate-/r/34.1%
associate-/r*34.1%
neg-mul-134.1%
associate-/r/34.4%
distribute-rgt-neg-in34.4%
associate-/r/34.1%
distribute-neg-frac34.1%
metadata-eval34.1%
associate-/r/34.4%
Simplified59.2%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
neg-mul-1100.0%
sub-neg100.0%
associate--l+100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
unpow2100.0%
div-sub100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(if (<= y -230000.0)
(+ x (/ (+ (- 1.0 x) (/ (+ -1.0 x) y)) y))
(if (<= y 320000.0)
(+ 1.0 (* y (/ (+ -1.0 x) (+ y 1.0))))
(+ (- x (/ (- 1.0 x) (* y y))) (/ (- 1.0 x) y)))))
double code(double x, double y) {
double tmp;
if (y <= -230000.0) {
tmp = x + (((1.0 - x) + ((-1.0 + x) / y)) / y);
} else if (y <= 320000.0) {
tmp = 1.0 + (y * ((-1.0 + x) / (y + 1.0)));
} else {
tmp = (x - ((1.0 - x) / (y * y))) + ((1.0 - x) / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-230000.0d0)) then
tmp = x + (((1.0d0 - x) + (((-1.0d0) + x) / y)) / y)
else if (y <= 320000.0d0) then
tmp = 1.0d0 + (y * (((-1.0d0) + x) / (y + 1.0d0)))
else
tmp = (x - ((1.0d0 - x) / (y * y))) + ((1.0d0 - x) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -230000.0) {
tmp = x + (((1.0 - x) + ((-1.0 + x) / y)) / y);
} else if (y <= 320000.0) {
tmp = 1.0 + (y * ((-1.0 + x) / (y + 1.0)));
} else {
tmp = (x - ((1.0 - x) / (y * y))) + ((1.0 - x) / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -230000.0: tmp = x + (((1.0 - x) + ((-1.0 + x) / y)) / y) elif y <= 320000.0: tmp = 1.0 + (y * ((-1.0 + x) / (y + 1.0))) else: tmp = (x - ((1.0 - x) / (y * y))) + ((1.0 - x) / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -230000.0) tmp = Float64(x + Float64(Float64(Float64(1.0 - x) + Float64(Float64(-1.0 + x) / y)) / y)); elseif (y <= 320000.0) tmp = Float64(1.0 + Float64(y * Float64(Float64(-1.0 + x) / Float64(y + 1.0)))); else tmp = Float64(Float64(x - Float64(Float64(1.0 - x) / Float64(y * y))) + Float64(Float64(1.0 - x) / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -230000.0) tmp = x + (((1.0 - x) + ((-1.0 + x) / y)) / y); elseif (y <= 320000.0) tmp = 1.0 + (y * ((-1.0 + x) / (y + 1.0))); else tmp = (x - ((1.0 - x) / (y * y))) + ((1.0 - x) / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -230000.0], N[(x + N[(N[(N[(1.0 - x), $MachinePrecision] + N[(N[(-1.0 + x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 320000.0], N[(1.0 + N[(y * N[(N[(-1.0 + x), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(N[(1.0 - x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -230000:\\
\;\;\;\;x + \frac{\left(1 - x\right) + \frac{-1 + x}{y}}{y}\\
\mathbf{elif}\;y \leq 320000:\\
\;\;\;\;1 + y \cdot \frac{-1 + x}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(x - \frac{1 - x}{y \cdot y}\right) + \frac{1 - x}{y}\\
\end{array}
\end{array}
if y < -2.3e5Initial program 27.0%
sub-neg27.0%
distribute-neg-frac27.0%
neg-mul-127.0%
associate-*l/26.6%
metadata-eval26.6%
associate-*l/26.6%
associate-/r/26.6%
metadata-eval26.6%
distribute-neg-frac26.6%
cancel-sign-sub-inv26.6%
associate-/r/27.0%
associate-/r*27.0%
neg-mul-127.0%
associate-/r/26.6%
distribute-rgt-neg-in26.6%
associate-/r/27.0%
distribute-neg-frac27.0%
metadata-eval27.0%
associate-/r/26.6%
Simplified55.3%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
neg-mul-1100.0%
sub-neg100.0%
associate--l+100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
unpow2100.0%
div-sub100.0%
Simplified100.0%
associate-+l-100.0%
associate-/r*100.0%
sub-div100.0%
Applied egg-rr100.0%
if -2.3e5 < y < 3.2e5Initial program 99.9%
sub-neg99.9%
distribute-neg-frac99.9%
neg-mul-199.9%
associate-*l/99.9%
metadata-eval99.9%
associate-*l/99.9%
associate-/r/99.9%
metadata-eval99.9%
distribute-neg-frac99.9%
cancel-sign-sub-inv99.9%
associate-/r/99.9%
associate-/r*99.9%
neg-mul-199.9%
associate-/r/99.9%
distribute-rgt-neg-in99.9%
associate-/r/99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
associate-/r/99.9%
Simplified99.9%
if 3.2e5 < y Initial program 34.2%
sub-neg34.2%
distribute-neg-frac34.2%
neg-mul-134.2%
associate-*l/34.4%
metadata-eval34.4%
associate-*l/34.4%
associate-/r/34.4%
metadata-eval34.4%
distribute-neg-frac34.4%
cancel-sign-sub-inv34.4%
associate-/r/34.1%
associate-/r*34.1%
neg-mul-134.1%
associate-/r/34.4%
distribute-rgt-neg-in34.4%
associate-/r/34.1%
distribute-neg-frac34.1%
metadata-eval34.1%
associate-/r/34.4%
Simplified59.2%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
neg-mul-1100.0%
sub-neg100.0%
associate--l+100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
unpow2100.0%
div-sub100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (or (<= y -230000.0) (not (<= y 320000.0))) (+ x (/ (+ (- 1.0 x) (/ (+ -1.0 x) y)) y)) (+ 1.0 (* y (/ (+ -1.0 x) (+ y 1.0))))))
double code(double x, double y) {
double tmp;
if ((y <= -230000.0) || !(y <= 320000.0)) {
tmp = x + (((1.0 - x) + ((-1.0 + x) / y)) / 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 <= (-230000.0d0)) .or. (.not. (y <= 320000.0d0))) then
tmp = x + (((1.0d0 - x) + (((-1.0d0) + x) / y)) / 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 <= -230000.0) || !(y <= 320000.0)) {
tmp = x + (((1.0 - x) + ((-1.0 + x) / y)) / y);
} else {
tmp = 1.0 + (y * ((-1.0 + x) / (y + 1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -230000.0) or not (y <= 320000.0): tmp = x + (((1.0 - x) + ((-1.0 + x) / y)) / y) else: tmp = 1.0 + (y * ((-1.0 + x) / (y + 1.0))) return tmp
function code(x, y) tmp = 0.0 if ((y <= -230000.0) || !(y <= 320000.0)) tmp = Float64(x + Float64(Float64(Float64(1.0 - x) + Float64(Float64(-1.0 + x) / y)) / y)); else tmp = Float64(1.0 + Float64(y * Float64(Float64(-1.0 + x) / Float64(y + 1.0)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -230000.0) || ~((y <= 320000.0))) tmp = x + (((1.0 - x) + ((-1.0 + x) / y)) / y); else tmp = 1.0 + (y * ((-1.0 + x) / (y + 1.0))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -230000.0], N[Not[LessEqual[y, 320000.0]], $MachinePrecision]], N[(x + N[(N[(N[(1.0 - x), $MachinePrecision] + N[(N[(-1.0 + x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(N[(-1.0 + x), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -230000 \lor \neg \left(y \leq 320000\right):\\
\;\;\;\;x + \frac{\left(1 - x\right) + \frac{-1 + x}{y}}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{-1 + x}{y + 1}\\
\end{array}
\end{array}
if y < -2.3e5 or 3.2e5 < y Initial program 30.5%
sub-neg30.5%
distribute-neg-frac30.5%
neg-mul-130.5%
associate-*l/30.4%
metadata-eval30.4%
associate-*l/30.4%
associate-/r/30.4%
metadata-eval30.4%
distribute-neg-frac30.4%
cancel-sign-sub-inv30.4%
associate-/r/30.4%
associate-/r*30.4%
neg-mul-130.4%
associate-/r/30.4%
distribute-rgt-neg-in30.4%
associate-/r/30.4%
distribute-neg-frac30.4%
metadata-eval30.4%
associate-/r/30.4%
Simplified57.1%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
neg-mul-1100.0%
sub-neg100.0%
associate--l+100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
unpow2100.0%
div-sub100.0%
Simplified100.0%
associate-+l-100.0%
associate-/r*100.0%
sub-div100.0%
Applied egg-rr100.0%
if -2.3e5 < y < 3.2e5Initial program 99.9%
sub-neg99.9%
distribute-neg-frac99.9%
neg-mul-199.9%
associate-*l/99.9%
metadata-eval99.9%
associate-*l/99.9%
associate-/r/99.9%
metadata-eval99.9%
distribute-neg-frac99.9%
cancel-sign-sub-inv99.9%
associate-/r/99.9%
associate-/r*99.9%
neg-mul-199.9%
associate-/r/99.9%
distribute-rgt-neg-in99.9%
associate-/r/99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
associate-/r/99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(if (<= y -1000000000.0)
(+ (/ 1.0 y) x)
(if (<= y 170000000.0)
(+ 1.0 (* y (/ (+ -1.0 x) (+ y 1.0))))
(+ x (/ (- 1.0 x) y)))))
double code(double x, double y) {
double tmp;
if (y <= -1000000000.0) {
tmp = (1.0 / y) + x;
} else if (y <= 170000000.0) {
tmp = 1.0 + (y * ((-1.0 + x) / (y + 1.0)));
} else {
tmp = x + ((1.0 - x) / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1000000000.0d0)) then
tmp = (1.0d0 / y) + x
else if (y <= 170000000.0d0) then
tmp = 1.0d0 + (y * (((-1.0d0) + x) / (y + 1.0d0)))
else
tmp = x + ((1.0d0 - x) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1000000000.0) {
tmp = (1.0 / y) + x;
} else if (y <= 170000000.0) {
tmp = 1.0 + (y * ((-1.0 + x) / (y + 1.0)));
} else {
tmp = x + ((1.0 - x) / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1000000000.0: tmp = (1.0 / y) + x elif y <= 170000000.0: tmp = 1.0 + (y * ((-1.0 + x) / (y + 1.0))) else: tmp = x + ((1.0 - x) / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -1000000000.0) tmp = Float64(Float64(1.0 / y) + x); elseif (y <= 170000000.0) tmp = Float64(1.0 + Float64(y * Float64(Float64(-1.0 + x) / Float64(y + 1.0)))); else tmp = Float64(x + Float64(Float64(1.0 - x) / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1000000000.0) tmp = (1.0 / y) + x; elseif (y <= 170000000.0) tmp = 1.0 + (y * ((-1.0 + x) / (y + 1.0))); else tmp = x + ((1.0 - x) / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1000000000.0], N[(N[(1.0 / y), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[y, 170000000.0], N[(1.0 + N[(y * N[(N[(-1.0 + x), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1000000000:\\
\;\;\;\;\frac{1}{y} + x\\
\mathbf{elif}\;y \leq 170000000:\\
\;\;\;\;1 + y \cdot \frac{-1 + x}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1 - x}{y}\\
\end{array}
\end{array}
if y < -1e9Initial program 26.3%
sub-neg26.3%
distribute-neg-frac26.3%
neg-mul-126.3%
associate-*l/25.9%
metadata-eval25.9%
associate-*l/25.9%
associate-/r/25.9%
metadata-eval25.9%
distribute-neg-frac25.9%
cancel-sign-sub-inv25.9%
associate-/r/26.2%
associate-/r*26.2%
neg-mul-126.2%
associate-/r/25.9%
distribute-rgt-neg-in25.9%
associate-/r/26.2%
distribute-neg-frac26.2%
metadata-eval26.2%
associate-/r/25.9%
Simplified54.9%
Taylor expanded in y around inf 100.0%
associate--l+100.0%
fma-def100.0%
neg-mul-1100.0%
sub-neg100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 99.3%
if -1e9 < y < 1.7e8Initial program 99.4%
sub-neg99.4%
distribute-neg-frac99.4%
neg-mul-199.4%
associate-*l/99.4%
metadata-eval99.4%
associate-*l/99.4%
associate-/r/99.4%
metadata-eval99.4%
distribute-neg-frac99.4%
cancel-sign-sub-inv99.4%
associate-/r/99.4%
associate-/r*99.4%
neg-mul-199.4%
associate-/r/99.4%
distribute-rgt-neg-in99.4%
associate-/r/99.4%
distribute-neg-frac99.4%
metadata-eval99.4%
associate-/r/99.4%
Simplified99.4%
if 1.7e8 < y Initial program 33.7%
sub-neg33.7%
distribute-neg-frac33.7%
neg-mul-133.7%
associate-*l/34.0%
metadata-eval34.0%
associate-*l/34.0%
associate-/r/34.0%
metadata-eval34.0%
distribute-neg-frac34.0%
cancel-sign-sub-inv34.0%
associate-/r/33.7%
associate-/r*33.7%
neg-mul-133.7%
associate-/r/34.0%
distribute-rgt-neg-in34.0%
associate-/r/33.7%
distribute-neg-frac33.7%
metadata-eval33.7%
associate-/r/34.0%
Simplified59.1%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate--l+100.0%
div-sub100.0%
sub-neg100.0%
+-commutative100.0%
metadata-eval100.0%
distribute-neg-in100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
sub-neg100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification99.5%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (/ 1.0 y) x)))
(if (<= y -1.0)
t_0
(if (<= y 2.8e-139) (- 1.0 y) (if (<= y 0.65) (* y x) t_0)))))
double code(double x, double y) {
double t_0 = (1.0 / y) + x;
double tmp;
if (y <= -1.0) {
tmp = t_0;
} else if (y <= 2.8e-139) {
tmp = 1.0 - y;
} else if (y <= 0.65) {
tmp = y * x;
} 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
if (y <= (-1.0d0)) then
tmp = t_0
else if (y <= 2.8d-139) then
tmp = 1.0d0 - y
else if (y <= 0.65d0) then
tmp = y * x
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;
double tmp;
if (y <= -1.0) {
tmp = t_0;
} else if (y <= 2.8e-139) {
tmp = 1.0 - y;
} else if (y <= 0.65) {
tmp = y * x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (1.0 / y) + x tmp = 0 if y <= -1.0: tmp = t_0 elif y <= 2.8e-139: tmp = 1.0 - y elif y <= 0.65: tmp = y * x else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(1.0 / y) + x) tmp = 0.0 if (y <= -1.0) tmp = t_0; elseif (y <= 2.8e-139) tmp = Float64(1.0 - y); elseif (y <= 0.65) tmp = Float64(y * x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (1.0 / y) + x; tmp = 0.0; if (y <= -1.0) tmp = t_0; elseif (y <= 2.8e-139) tmp = 1.0 - y; elseif (y <= 0.65) tmp = y * x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(1.0 / y), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -1.0], t$95$0, If[LessEqual[y, 2.8e-139], N[(1.0 - y), $MachinePrecision], If[LessEqual[y, 0.65], N[(y * x), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{y} + x\\
\mathbf{if}\;y \leq -1:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{-139}:\\
\;\;\;\;1 - y\\
\mathbf{elif}\;y \leq 0.65:\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -1 or 0.650000000000000022 < y Initial program 30.9%
sub-neg30.9%
distribute-neg-frac30.9%
neg-mul-130.9%
associate-*l/30.8%
metadata-eval30.8%
associate-*l/30.8%
associate-/r/30.8%
metadata-eval30.8%
distribute-neg-frac30.8%
cancel-sign-sub-inv30.8%
associate-/r/30.9%
associate-/r*30.9%
neg-mul-130.9%
associate-/r/30.8%
distribute-rgt-neg-in30.8%
associate-/r/30.9%
distribute-neg-frac30.9%
metadata-eval30.9%
associate-/r/30.8%
Simplified57.4%
Taylor expanded in y around inf 99.5%
associate--l+99.5%
fma-def99.5%
neg-mul-199.5%
sub-neg99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in y around inf 98.2%
if -1 < y < 2.7999999999999999e-139Initial program 100.0%
Taylor expanded in x around 0 76.5%
Taylor expanded in y around 0 76.4%
neg-mul-176.4%
unsub-neg76.4%
Simplified76.4%
if 2.7999999999999999e-139 < y < 0.650000000000000022Initial program 99.9%
sub-neg99.9%
distribute-neg-frac99.9%
neg-mul-199.9%
associate-*l/99.8%
metadata-eval99.8%
associate-*l/99.8%
associate-/r/99.8%
metadata-eval99.8%
distribute-neg-frac99.8%
cancel-sign-sub-inv99.8%
associate-/r/99.7%
associate-/r*99.7%
neg-mul-199.7%
associate-/r/99.8%
distribute-rgt-neg-in99.8%
associate-/r/99.7%
distribute-neg-frac99.7%
metadata-eval99.7%
associate-/r/99.8%
Simplified99.9%
Taylor expanded in x around inf 63.8%
associate-/l*63.8%
Simplified63.8%
Taylor expanded in y around 0 56.4%
Final simplification85.2%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 0.82))) (+ (/ 1.0 y) x) (- 1.0 (* y (- 1.0 x)))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 0.82)) {
tmp = (1.0 / y) + x;
} 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 <= 0.82d0))) then
tmp = (1.0d0 / y) + x
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 <= 0.82)) {
tmp = (1.0 / y) + x;
} else {
tmp = 1.0 - (y * (1.0 - x));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 0.82): tmp = (1.0 / y) + x else: tmp = 1.0 - (y * (1.0 - x)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 0.82)) tmp = Float64(Float64(1.0 / y) + x); 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 <= 0.82))) tmp = (1.0 / y) + x; 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, 0.82]], $MachinePrecision]], N[(N[(1.0 / y), $MachinePrecision] + x), $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 0.82\right):\\
\;\;\;\;\frac{1}{y} + x\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot \left(1 - x\right)\\
\end{array}
\end{array}
if y < -1 or 0.819999999999999951 < y Initial program 30.9%
sub-neg30.9%
distribute-neg-frac30.9%
neg-mul-130.9%
associate-*l/30.8%
metadata-eval30.8%
associate-*l/30.8%
associate-/r/30.8%
metadata-eval30.8%
distribute-neg-frac30.8%
cancel-sign-sub-inv30.8%
associate-/r/30.9%
associate-/r*30.9%
neg-mul-130.9%
associate-/r/30.8%
distribute-rgt-neg-in30.8%
associate-/r/30.9%
distribute-neg-frac30.9%
metadata-eval30.9%
associate-/r/30.8%
Simplified57.4%
Taylor expanded in y around inf 99.5%
associate--l+99.5%
fma-def99.5%
neg-mul-199.5%
sub-neg99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in y around inf 98.2%
if -1 < y < 0.819999999999999951Initial program 100.0%
sub-neg100.0%
distribute-neg-frac100.0%
neg-mul-1100.0%
associate-*l/100.0%
metadata-eval100.0%
associate-*l/100.0%
associate-/r/100.0%
metadata-eval100.0%
distribute-neg-frac100.0%
cancel-sign-sub-inv100.0%
associate-/r/99.9%
associate-/r*99.9%
neg-mul-199.9%
associate-/r/100.0%
distribute-rgt-neg-in100.0%
associate-/r/99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in y around 0 97.6%
Final simplification97.9%
(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 30.9%
sub-neg30.9%
distribute-neg-frac30.9%
neg-mul-130.9%
associate-*l/30.8%
metadata-eval30.8%
associate-*l/30.8%
associate-/r/30.8%
metadata-eval30.8%
distribute-neg-frac30.8%
cancel-sign-sub-inv30.8%
associate-/r/30.9%
associate-/r*30.9%
neg-mul-130.9%
associate-/r/30.8%
distribute-rgt-neg-in30.8%
associate-/r/30.9%
distribute-neg-frac30.9%
metadata-eval30.9%
associate-/r/30.8%
Simplified57.4%
Taylor expanded in y around inf 98.5%
+-commutative98.5%
associate--l+98.5%
div-sub98.5%
sub-neg98.5%
+-commutative98.5%
metadata-eval98.5%
distribute-neg-in98.5%
distribute-neg-frac98.5%
metadata-eval98.5%
sub-neg98.5%
unsub-neg98.5%
sub-neg98.5%
metadata-eval98.5%
Simplified98.5%
if -1 < y < 1Initial program 100.0%
sub-neg100.0%
distribute-neg-frac100.0%
neg-mul-1100.0%
associate-*l/100.0%
metadata-eval100.0%
associate-*l/100.0%
associate-/r/100.0%
metadata-eval100.0%
distribute-neg-frac100.0%
cancel-sign-sub-inv100.0%
associate-/r/99.9%
associate-/r*99.9%
neg-mul-199.9%
associate-/r/100.0%
distribute-rgt-neg-in100.0%
associate-/r/99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in y around 0 97.6%
Final simplification98.0%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 1.2e-140) 1.0 (if (<= y 1.0) (* y x) x))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 1.2e-140) {
tmp = 1.0;
} else if (y <= 1.0) {
tmp = y * x;
} 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 <= 1.2d-140) then
tmp = 1.0d0
else if (y <= 1.0d0) then
tmp = y * x
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 <= 1.2e-140) {
tmp = 1.0;
} else if (y <= 1.0) {
tmp = y * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 1.2e-140: tmp = 1.0 elif y <= 1.0: tmp = y * x else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 1.2e-140) tmp = 1.0; elseif (y <= 1.0) tmp = Float64(y * x); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = x; elseif (y <= 1.2e-140) tmp = 1.0; elseif (y <= 1.0) tmp = y * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 1.2e-140], 1.0, If[LessEqual[y, 1.0], N[(y * x), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{-140}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 30.9%
sub-neg30.9%
distribute-neg-frac30.9%
neg-mul-130.9%
associate-*l/30.8%
metadata-eval30.8%
associate-*l/30.8%
associate-/r/30.8%
metadata-eval30.8%
distribute-neg-frac30.8%
cancel-sign-sub-inv30.8%
associate-/r/30.9%
associate-/r*30.9%
neg-mul-130.9%
associate-/r/30.8%
distribute-rgt-neg-in30.8%
associate-/r/30.9%
distribute-neg-frac30.9%
metadata-eval30.9%
associate-/r/30.8%
Simplified57.4%
Taylor expanded in y around inf 71.8%
if -1 < y < 1.19999999999999993e-140Initial program 100.0%
sub-neg100.0%
distribute-neg-frac100.0%
neg-mul-1100.0%
associate-*l/100.0%
metadata-eval100.0%
associate-*l/100.0%
associate-/r/100.0%
metadata-eval100.0%
distribute-neg-frac100.0%
cancel-sign-sub-inv100.0%
associate-/r/100.0%
associate-/r*100.0%
neg-mul-1100.0%
associate-/r/100.0%
distribute-rgt-neg-in100.0%
associate-/r/100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in y around 0 76.0%
if 1.19999999999999993e-140 < y < 1Initial program 99.9%
sub-neg99.9%
distribute-neg-frac99.9%
neg-mul-199.9%
associate-*l/99.8%
metadata-eval99.8%
associate-*l/99.8%
associate-/r/99.8%
metadata-eval99.8%
distribute-neg-frac99.8%
cancel-sign-sub-inv99.8%
associate-/r/99.7%
associate-/r*99.7%
neg-mul-199.7%
associate-/r/99.8%
distribute-rgt-neg-in99.8%
associate-/r/99.7%
distribute-neg-frac99.7%
metadata-eval99.7%
associate-/r/99.8%
Simplified99.9%
Taylor expanded in x around inf 63.8%
associate-/l*63.8%
Simplified63.8%
Taylor expanded in y around 0 56.4%
Final simplification71.9%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 2.7e-139) (- 1.0 y) (if (<= y 1.0) (* y x) x))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 2.7e-139) {
tmp = 1.0 - y;
} else if (y <= 1.0) {
tmp = y * x;
} 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-139) then
tmp = 1.0d0 - y
else if (y <= 1.0d0) then
tmp = y * x
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-139) {
tmp = 1.0 - y;
} else if (y <= 1.0) {
tmp = y * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 2.7e-139: tmp = 1.0 - y elif y <= 1.0: tmp = y * x else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 2.7e-139) tmp = Float64(1.0 - y); elseif (y <= 1.0) tmp = Float64(y * x); 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-139) tmp = 1.0 - y; elseif (y <= 1.0) tmp = y * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 2.7e-139], N[(1.0 - y), $MachinePrecision], If[LessEqual[y, 1.0], N[(y * x), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{-139}:\\
\;\;\;\;1 - y\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 30.9%
sub-neg30.9%
distribute-neg-frac30.9%
neg-mul-130.9%
associate-*l/30.8%
metadata-eval30.8%
associate-*l/30.8%
associate-/r/30.8%
metadata-eval30.8%
distribute-neg-frac30.8%
cancel-sign-sub-inv30.8%
associate-/r/30.9%
associate-/r*30.9%
neg-mul-130.9%
associate-/r/30.8%
distribute-rgt-neg-in30.8%
associate-/r/30.9%
distribute-neg-frac30.9%
metadata-eval30.9%
associate-/r/30.8%
Simplified57.4%
Taylor expanded in y around inf 71.8%
if -1 < y < 2.6999999999999998e-139Initial program 100.0%
Taylor expanded in x around 0 76.5%
Taylor expanded in y around 0 76.4%
neg-mul-176.4%
unsub-neg76.4%
Simplified76.4%
if 2.6999999999999998e-139 < y < 1Initial program 99.9%
sub-neg99.9%
distribute-neg-frac99.9%
neg-mul-199.9%
associate-*l/99.8%
metadata-eval99.8%
associate-*l/99.8%
associate-/r/99.8%
metadata-eval99.8%
distribute-neg-frac99.8%
cancel-sign-sub-inv99.8%
associate-/r/99.7%
associate-/r*99.7%
neg-mul-199.7%
associate-/r/99.8%
distribute-rgt-neg-in99.8%
associate-/r/99.7%
distribute-neg-frac99.7%
metadata-eval99.7%
associate-/r/99.8%
Simplified99.9%
Taylor expanded in x around inf 63.8%
associate-/l*63.8%
Simplified63.8%
Taylor expanded in y around 0 56.4%
Final simplification72.0%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (+ (/ 1.0 y) x) (+ 1.0 (* y x))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = (1.0 / y) + x;
} else {
tmp = 1.0 + (y * 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 = (1.0d0 / y) + x
else
tmp = 1.0d0 + (y * 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 = (1.0 / y) + x;
} else {
tmp = 1.0 + (y * x);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 1.0): tmp = (1.0 / y) + x else: tmp = 1.0 + (y * x) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.0)) tmp = Float64(Float64(1.0 / y) + x); else tmp = Float64(1.0 + Float64(y * x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.0) || ~((y <= 1.0))) tmp = (1.0 / y) + x; else tmp = 1.0 + (y * x); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(N[(1.0 / y), $MachinePrecision] + x), $MachinePrecision], N[(1.0 + N[(y * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;\frac{1}{y} + x\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot x\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 30.9%
sub-neg30.9%
distribute-neg-frac30.9%
neg-mul-130.9%
associate-*l/30.8%
metadata-eval30.8%
associate-*l/30.8%
associate-/r/30.8%
metadata-eval30.8%
distribute-neg-frac30.8%
cancel-sign-sub-inv30.8%
associate-/r/30.9%
associate-/r*30.9%
neg-mul-130.9%
associate-/r/30.8%
distribute-rgt-neg-in30.8%
associate-/r/30.9%
distribute-neg-frac30.9%
metadata-eval30.9%
associate-/r/30.8%
Simplified57.4%
Taylor expanded in y around inf 99.5%
associate--l+99.5%
fma-def99.5%
neg-mul-199.5%
sub-neg99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in y around inf 98.2%
if -1 < y < 1Initial program 100.0%
sub-neg100.0%
distribute-neg-frac100.0%
neg-mul-1100.0%
associate-*l/100.0%
metadata-eval100.0%
associate-*l/100.0%
associate-/r/100.0%
metadata-eval100.0%
distribute-neg-frac100.0%
cancel-sign-sub-inv100.0%
associate-/r/99.9%
associate-/r*99.9%
neg-mul-199.9%
associate-/r/100.0%
distribute-rgt-neg-in100.0%
associate-/r/99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in y around 0 97.6%
Taylor expanded in x around inf 97.1%
mul-1-neg97.1%
distribute-rgt-neg-out97.1%
Simplified97.1%
Final simplification97.6%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 0.0001) 1.0 x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 0.0001) {
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 <= 0.0001d0) 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 <= 0.0001) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 0.0001: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 0.0001) 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 <= 0.0001) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 0.0001], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 0.0001:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 1.00000000000000005e-4 < y Initial program 32.0%
sub-neg32.0%
distribute-neg-frac32.0%
neg-mul-132.0%
associate-*l/31.9%
metadata-eval31.9%
associate-*l/31.9%
associate-/r/31.9%
metadata-eval31.9%
distribute-neg-frac31.9%
cancel-sign-sub-inv31.9%
associate-/r/32.0%
associate-/r*32.0%
neg-mul-132.0%
associate-/r/31.9%
distribute-rgt-neg-in31.9%
associate-/r/32.0%
distribute-neg-frac32.0%
metadata-eval32.0%
associate-/r/31.9%
Simplified58.1%
Taylor expanded in y around inf 70.9%
if -1 < y < 1.00000000000000005e-4Initial program 100.0%
sub-neg100.0%
distribute-neg-frac100.0%
neg-mul-1100.0%
associate-*l/100.0%
metadata-eval100.0%
associate-*l/100.0%
associate-/r/100.0%
metadata-eval100.0%
distribute-neg-frac100.0%
cancel-sign-sub-inv100.0%
associate-/r/99.9%
associate-/r*99.9%
neg-mul-199.9%
associate-/r/100.0%
distribute-rgt-neg-in100.0%
associate-/r/99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in y around 0 68.6%
Final simplification69.8%
(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.5%
sub-neg65.5%
distribute-neg-frac65.5%
neg-mul-165.5%
associate-*l/65.4%
metadata-eval65.4%
associate-*l/65.4%
associate-/r/65.4%
metadata-eval65.4%
distribute-neg-frac65.4%
cancel-sign-sub-inv65.4%
associate-/r/65.4%
associate-/r*65.4%
neg-mul-165.4%
associate-/r/65.4%
distribute-rgt-neg-in65.4%
associate-/r/65.4%
distribute-neg-frac65.4%
metadata-eval65.4%
associate-/r/65.4%
Simplified78.7%
Taylor expanded in y around 0 35.8%
Final simplification35.8%
(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 2023200
(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))))