
(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 13 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 y))) (t_1 (/ (- 1.0 x) y)))
(if (<= y -11500.0)
(+ (+ x (+ (/ (- 1.0 x) (pow y 3.0)) t_1)) t_0)
(if (<= y 200000.0)
(fma (/ (+ x -1.0) (+ y 1.0)) y 1.0)
(+ t_0 (+ x t_1))))))
double code(double x, double y) {
double t_0 = (x + -1.0) / (y * y);
double t_1 = (1.0 - x) / y;
double tmp;
if (y <= -11500.0) {
tmp = (x + (((1.0 - x) / pow(y, 3.0)) + t_1)) + t_0;
} else if (y <= 200000.0) {
tmp = fma(((x + -1.0) / (y + 1.0)), y, 1.0);
} else {
tmp = t_0 + (x + t_1);
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(x + -1.0) / Float64(y * y)) t_1 = Float64(Float64(1.0 - x) / y) tmp = 0.0 if (y <= -11500.0) tmp = Float64(Float64(x + Float64(Float64(Float64(1.0 - x) / (y ^ 3.0)) + t_1)) + t_0); elseif (y <= 200000.0) tmp = fma(Float64(Float64(x + -1.0) / Float64(y + 1.0)), y, 1.0); else tmp = Float64(t_0 + Float64(x + t_1)); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(x + -1.0), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[y, -11500.0], N[(N[(x + N[(N[(N[(1.0 - x), $MachinePrecision] / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[y, 200000.0], N[(N[(N[(x + -1.0), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] * y + 1.0), $MachinePrecision], N[(t$95$0 + N[(x + t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + -1}{y \cdot y}\\
t_1 := \frac{1 - x}{y}\\
\mathbf{if}\;y \leq -11500:\\
\;\;\;\;\left(x + \left(\frac{1 - x}{{y}^{3}} + t_1\right)\right) + t_0\\
\mathbf{elif}\;y \leq 200000:\\
\;\;\;\;\mathsf{fma}\left(\frac{x + -1}{y + 1}, y, 1\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(x + t_1\right)\\
\end{array}
\end{array}
if y < -11500Initial program 23.2%
sub-neg23.2%
distribute-neg-frac23.2%
neg-mul-123.2%
associate-*l/22.7%
metadata-eval22.7%
associate-*l/22.7%
associate-/r/22.7%
metadata-eval22.7%
distribute-neg-frac22.7%
cancel-sign-sub-inv22.7%
associate-/r/23.1%
associate-/r*23.1%
neg-mul-123.1%
associate-/r/22.7%
distribute-rgt-neg-in22.7%
associate-/r/23.1%
distribute-neg-frac23.1%
metadata-eval23.1%
associate-/r/22.7%
Simplified49.6%
Taylor expanded in y around -inf 100.0%
+-commutative100.0%
associate--l+100.0%
Simplified100.0%
if -11500 < y < 2e5Initial program 99.7%
sub-neg99.7%
+-commutative99.7%
associate-/l*99.7%
distribute-neg-frac99.7%
associate-/r/99.7%
fma-def99.8%
neg-sub099.8%
associate--r-99.8%
metadata-eval99.8%
+-commutative99.8%
+-commutative99.8%
Simplified99.8%
if 2e5 < y Initial program 36.0%
sub-neg36.0%
distribute-neg-frac36.0%
neg-mul-136.0%
associate-*l/36.0%
metadata-eval36.0%
associate-*l/36.0%
associate-/r/36.0%
metadata-eval36.0%
distribute-neg-frac36.0%
cancel-sign-sub-inv36.0%
associate-/r/35.9%
associate-/r*35.9%
neg-mul-135.9%
associate-/r/36.0%
distribute-rgt-neg-in36.0%
associate-/r/35.9%
distribute-neg-frac35.9%
metadata-eval35.9%
associate-/r/36.0%
Simplified55.7%
Taylor expanded in y around -inf 100.0%
+-commutative100.0%
associate--l+100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
div-sub100.0%
sub-neg100.0%
metadata-eval100.0%
unpow2100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (or (<= y -290000.0) (not (<= y 200000.0))) (+ (/ (+ x -1.0) (* y y)) (+ x (/ (- 1.0 x) y))) (fma (/ (+ x -1.0) (+ y 1.0)) y 1.0)))
double code(double x, double y) {
double tmp;
if ((y <= -290000.0) || !(y <= 200000.0)) {
tmp = ((x + -1.0) / (y * y)) + (x + ((1.0 - x) / y));
} else {
tmp = fma(((x + -1.0) / (y + 1.0)), y, 1.0);
}
return tmp;
}
function code(x, y) tmp = 0.0 if ((y <= -290000.0) || !(y <= 200000.0)) tmp = Float64(Float64(Float64(x + -1.0) / Float64(y * y)) + Float64(x + Float64(Float64(1.0 - x) / y))); else tmp = fma(Float64(Float64(x + -1.0) / Float64(y + 1.0)), y, 1.0); end return tmp end
code[x_, y_] := If[Or[LessEqual[y, -290000.0], N[Not[LessEqual[y, 200000.0]], $MachinePrecision]], N[(N[(N[(x + -1.0), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x + -1.0), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] * y + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -290000 \lor \neg \left(y \leq 200000\right):\\
\;\;\;\;\frac{x + -1}{y \cdot y} + \left(x + \frac{1 - x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x + -1}{y + 1}, y, 1\right)\\
\end{array}
\end{array}
if y < -2.9e5 or 2e5 < y Initial program 29.7%
sub-neg29.7%
distribute-neg-frac29.7%
neg-mul-129.7%
associate-*l/29.5%
metadata-eval29.5%
associate-*l/29.5%
associate-/r/29.5%
metadata-eval29.5%
distribute-neg-frac29.5%
cancel-sign-sub-inv29.5%
associate-/r/29.6%
associate-/r*29.6%
neg-mul-129.6%
associate-/r/29.5%
distribute-rgt-neg-in29.5%
associate-/r/29.6%
distribute-neg-frac29.6%
metadata-eval29.6%
associate-/r/29.5%
Simplified52.7%
Taylor expanded in y around -inf 99.8%
+-commutative99.8%
associate--l+99.8%
+-commutative99.8%
mul-1-neg99.8%
unsub-neg99.8%
sub-neg99.8%
metadata-eval99.8%
div-sub99.8%
sub-neg99.8%
metadata-eval99.8%
unpow299.8%
Simplified99.8%
if -2.9e5 < y < 2e5Initial program 99.7%
sub-neg99.7%
+-commutative99.7%
associate-/l*99.7%
distribute-neg-frac99.7%
associate-/r/99.7%
fma-def99.8%
neg-sub099.8%
associate--r-99.8%
metadata-eval99.8%
+-commutative99.8%
+-commutative99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y) :precision binary64 (if (or (<= y -410000.0) (not (<= y 200000.0))) (+ (/ (+ x -1.0) (* y y)) (+ x (/ (- 1.0 x) y))) (+ 1.0 (* y (/ (+ x -1.0) (+ y 1.0))))))
double code(double x, double y) {
double tmp;
if ((y <= -410000.0) || !(y <= 200000.0)) {
tmp = ((x + -1.0) / (y * y)) + (x + ((1.0 - x) / y));
} else {
tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-410000.0d0)) .or. (.not. (y <= 200000.0d0))) then
tmp = ((x + (-1.0d0)) / (y * y)) + (x + ((1.0d0 - x) / y))
else
tmp = 1.0d0 + (y * ((x + (-1.0d0)) / (y + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -410000.0) || !(y <= 200000.0)) {
tmp = ((x + -1.0) / (y * y)) + (x + ((1.0 - x) / y));
} else {
tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -410000.0) or not (y <= 200000.0): tmp = ((x + -1.0) / (y * y)) + (x + ((1.0 - x) / y)) else: tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0))) return tmp
function code(x, y) tmp = 0.0 if ((y <= -410000.0) || !(y <= 200000.0)) tmp = Float64(Float64(Float64(x + -1.0) / Float64(y * y)) + Float64(x + Float64(Float64(1.0 - x) / y))); else tmp = Float64(1.0 + Float64(y * Float64(Float64(x + -1.0) / Float64(y + 1.0)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -410000.0) || ~((y <= 200000.0))) tmp = ((x + -1.0) / (y * y)) + (x + ((1.0 - x) / y)); else tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -410000.0], N[Not[LessEqual[y, 200000.0]], $MachinePrecision]], N[(N[(N[(x + -1.0), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(N[(x + -1.0), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -410000 \lor \neg \left(y \leq 200000\right):\\
\;\;\;\;\frac{x + -1}{y \cdot y} + \left(x + \frac{1 - x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\
\end{array}
\end{array}
if y < -4.1e5 or 2e5 < y Initial program 29.7%
sub-neg29.7%
distribute-neg-frac29.7%
neg-mul-129.7%
associate-*l/29.5%
metadata-eval29.5%
associate-*l/29.5%
associate-/r/29.5%
metadata-eval29.5%
distribute-neg-frac29.5%
cancel-sign-sub-inv29.5%
associate-/r/29.6%
associate-/r*29.6%
neg-mul-129.6%
associate-/r/29.5%
distribute-rgt-neg-in29.5%
associate-/r/29.6%
distribute-neg-frac29.6%
metadata-eval29.6%
associate-/r/29.5%
Simplified52.7%
Taylor expanded in y around -inf 99.8%
+-commutative99.8%
associate--l+99.8%
+-commutative99.8%
mul-1-neg99.8%
unsub-neg99.8%
sub-neg99.8%
metadata-eval99.8%
div-sub99.8%
sub-neg99.8%
metadata-eval99.8%
unpow299.8%
Simplified99.8%
if -4.1e5 < y < 2e5Initial program 99.7%
sub-neg99.7%
distribute-neg-frac99.7%
neg-mul-199.7%
associate-*l/99.7%
metadata-eval99.7%
associate-*l/99.7%
associate-/r/99.7%
metadata-eval99.7%
distribute-neg-frac99.7%
cancel-sign-sub-inv99.7%
associate-/r/99.7%
associate-/r*99.7%
neg-mul-199.7%
associate-/r/99.7%
distribute-rgt-neg-in99.7%
associate-/r/99.7%
distribute-neg-frac99.7%
metadata-eval99.7%
associate-/r/99.7%
Simplified99.7%
Final simplification99.8%
(FPCore (x y) :precision binary64 (if (or (<= y -120000000000.0) (not (<= y 24000000000.0))) (- x (/ -1.0 y)) (+ 1.0 (* y (/ (+ x -1.0) (+ y 1.0))))))
double code(double x, double y) {
double tmp;
if ((y <= -120000000000.0) || !(y <= 24000000000.0)) {
tmp = x - (-1.0 / y);
} else {
tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-120000000000.0d0)) .or. (.not. (y <= 24000000000.0d0))) then
tmp = x - ((-1.0d0) / y)
else
tmp = 1.0d0 + (y * ((x + (-1.0d0)) / (y + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -120000000000.0) || !(y <= 24000000000.0)) {
tmp = x - (-1.0 / y);
} else {
tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -120000000000.0) or not (y <= 24000000000.0): tmp = x - (-1.0 / y) else: tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0))) return tmp
function code(x, y) tmp = 0.0 if ((y <= -120000000000.0) || !(y <= 24000000000.0)) tmp = Float64(x - Float64(-1.0 / y)); else tmp = Float64(1.0 + Float64(y * Float64(Float64(x + -1.0) / Float64(y + 1.0)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -120000000000.0) || ~((y <= 24000000000.0))) tmp = x - (-1.0 / y); else tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -120000000000.0], N[Not[LessEqual[y, 24000000000.0]], $MachinePrecision]], N[(x - N[(-1.0 / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(N[(x + -1.0), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -120000000000 \lor \neg \left(y \leq 24000000000\right):\\
\;\;\;\;x - \frac{-1}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\
\end{array}
\end{array}
if y < -1.2e11 or 2.4e10 < y Initial program 28.5%
sub-neg28.5%
distribute-neg-frac28.5%
neg-mul-128.5%
associate-*l/28.3%
metadata-eval28.3%
associate-*l/28.3%
associate-/r/28.3%
metadata-eval28.3%
distribute-neg-frac28.3%
cancel-sign-sub-inv28.3%
associate-/r/28.4%
associate-/r*28.4%
neg-mul-128.4%
associate-/r/28.3%
distribute-rgt-neg-in28.3%
associate-/r/28.4%
distribute-neg-frac28.4%
metadata-eval28.4%
associate-/r/28.3%
Simplified52.0%
Taylor expanded in y around inf 99.9%
+-commutative99.9%
associate--l+99.9%
div-sub99.9%
sub-neg99.9%
+-commutative99.9%
metadata-eval99.9%
distribute-neg-in99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
sub-neg99.9%
unsub-neg99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
if -1.2e11 < y < 2.4e10Initial program 99.3%
sub-neg99.3%
distribute-neg-frac99.3%
neg-mul-199.3%
associate-*l/99.2%
metadata-eval99.2%
associate-*l/99.2%
associate-/r/99.2%
metadata-eval99.2%
distribute-neg-frac99.2%
cancel-sign-sub-inv99.2%
associate-/r/99.2%
associate-/r*99.2%
neg-mul-199.2%
associate-/r/99.2%
distribute-rgt-neg-in99.2%
associate-/r/99.2%
distribute-neg-frac99.2%
metadata-eval99.2%
associate-/r/99.2%
Simplified99.3%
Final simplification99.5%
(FPCore (x y) :precision binary64 (if (or (<= y -31000000000.0) (not (<= y 350000000000.0))) (- x (/ -1.0 y)) (+ 1.0 (/ (* y (+ x -1.0)) (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -31000000000.0) || !(y <= 350000000000.0)) {
tmp = x - (-1.0 / y);
} else {
tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-31000000000.0d0)) .or. (.not. (y <= 350000000000.0d0))) then
tmp = x - ((-1.0d0) / y)
else
tmp = 1.0d0 + ((y * (x + (-1.0d0))) / (y + 1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -31000000000.0) || !(y <= 350000000000.0)) {
tmp = x - (-1.0 / y);
} else {
tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -31000000000.0) or not (y <= 350000000000.0): tmp = x - (-1.0 / y) else: tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -31000000000.0) || !(y <= 350000000000.0)) tmp = Float64(x - Float64(-1.0 / y)); else tmp = Float64(1.0 + Float64(Float64(y * Float64(x + -1.0)) / Float64(y + 1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -31000000000.0) || ~((y <= 350000000000.0))) tmp = x - (-1.0 / y); else tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -31000000000.0], N[Not[LessEqual[y, 350000000000.0]], $MachinePrecision]], N[(x - N[(-1.0 / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -31000000000 \lor \neg \left(y \leq 350000000000\right):\\
\;\;\;\;x - \frac{-1}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y \cdot \left(x + -1\right)}{y + 1}\\
\end{array}
\end{array}
if y < -3.1e10 or 3.5e11 < y Initial program 28.5%
sub-neg28.5%
distribute-neg-frac28.5%
neg-mul-128.5%
associate-*l/28.3%
metadata-eval28.3%
associate-*l/28.3%
associate-/r/28.3%
metadata-eval28.3%
distribute-neg-frac28.3%
cancel-sign-sub-inv28.3%
associate-/r/28.4%
associate-/r*28.4%
neg-mul-128.4%
associate-/r/28.3%
distribute-rgt-neg-in28.3%
associate-/r/28.4%
distribute-neg-frac28.4%
metadata-eval28.4%
associate-/r/28.3%
Simplified52.0%
Taylor expanded in y around inf 99.9%
+-commutative99.9%
associate--l+99.9%
div-sub99.9%
sub-neg99.9%
+-commutative99.9%
metadata-eval99.9%
distribute-neg-in99.9%
distribute-neg-frac99.9%
metadata-eval99.9%
sub-neg99.9%
unsub-neg99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
if -3.1e10 < y < 3.5e11Initial program 99.3%
Final simplification99.5%
(FPCore (x y) :precision binary64 (if (<= y -62.0) (- x (/ -1.0 y)) (if (<= y 1000.0) (- 1.0 (/ (* y x) (- -1.0 y))) (+ x (/ (- 1.0 x) y)))))
double code(double x, double y) {
double tmp;
if (y <= -62.0) {
tmp = x - (-1.0 / y);
} else if (y <= 1000.0) {
tmp = 1.0 - ((y * x) / (-1.0 - y));
} 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 <= (-62.0d0)) then
tmp = x - ((-1.0d0) / y)
else if (y <= 1000.0d0) then
tmp = 1.0d0 - ((y * x) / ((-1.0d0) - y))
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 <= -62.0) {
tmp = x - (-1.0 / y);
} else if (y <= 1000.0) {
tmp = 1.0 - ((y * x) / (-1.0 - y));
} else {
tmp = x + ((1.0 - x) / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -62.0: tmp = x - (-1.0 / y) elif y <= 1000.0: tmp = 1.0 - ((y * x) / (-1.0 - y)) else: tmp = x + ((1.0 - x) / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -62.0) tmp = Float64(x - Float64(-1.0 / y)); elseif (y <= 1000.0) tmp = Float64(1.0 - Float64(Float64(y * x) / Float64(-1.0 - y))); 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 <= -62.0) tmp = x - (-1.0 / y); elseif (y <= 1000.0) tmp = 1.0 - ((y * x) / (-1.0 - y)); else tmp = x + ((1.0 - x) / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -62.0], N[(x - N[(-1.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1000.0], N[(1.0 - N[(N[(y * x), $MachinePrecision] / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -62:\\
\;\;\;\;x - \frac{-1}{y}\\
\mathbf{elif}\;y \leq 1000:\\
\;\;\;\;1 - \frac{y \cdot x}{-1 - y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1 - x}{y}\\
\end{array}
\end{array}
if y < -62Initial program 23.2%
sub-neg23.2%
distribute-neg-frac23.2%
neg-mul-123.2%
associate-*l/22.7%
metadata-eval22.7%
associate-*l/22.7%
associate-/r/22.7%
metadata-eval22.7%
distribute-neg-frac22.7%
cancel-sign-sub-inv22.7%
associate-/r/23.1%
associate-/r*23.1%
neg-mul-123.1%
associate-/r/22.7%
distribute-rgt-neg-in22.7%
associate-/r/23.1%
distribute-neg-frac23.1%
metadata-eval23.1%
associate-/r/22.7%
Simplified49.6%
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%
Taylor expanded in x around 0 98.5%
if -62 < y < 1e3Initial 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 x around inf 99.0%
neg-mul-199.0%
distribute-neg-frac99.0%
Simplified99.0%
associate-*l/99.0%
frac-2neg99.0%
add-sqr-sqrt61.0%
sqrt-unprod73.9%
sqr-neg73.9%
sqrt-unprod26.7%
add-sqr-sqrt73.2%
*-commutative73.2%
distribute-rgt-neg-in73.2%
add-sqr-sqrt46.5%
sqrt-unprod72.7%
sqr-neg72.7%
sqrt-unprod37.9%
add-sqr-sqrt99.0%
*-commutative99.0%
Applied egg-rr99.0%
*-commutative99.0%
distribute-neg-in99.0%
metadata-eval99.0%
unsub-neg99.0%
Simplified99.0%
if 1e3 < y Initial program 37.5%
sub-neg37.5%
distribute-neg-frac37.5%
neg-mul-137.5%
associate-*l/37.5%
metadata-eval37.5%
associate-*l/37.5%
associate-/r/37.5%
metadata-eval37.5%
distribute-neg-frac37.5%
cancel-sign-sub-inv37.5%
associate-/r/37.4%
associate-/r*37.4%
neg-mul-137.4%
associate-/r/37.5%
distribute-rgt-neg-in37.5%
associate-/r/37.4%
distribute-neg-frac37.4%
metadata-eval37.4%
associate-/r/37.5%
Simplified56.5%
Taylor expanded in y around inf 97.4%
+-commutative97.4%
associate--l+97.4%
div-sub97.4%
sub-neg97.4%
+-commutative97.4%
metadata-eval97.4%
distribute-neg-in97.4%
distribute-neg-frac97.4%
metadata-eval97.4%
sub-neg97.4%
unsub-neg97.4%
sub-neg97.4%
metadata-eval97.4%
Simplified97.4%
Final simplification98.5%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 0.8))) (- x (/ -1.0 y)) (+ 1.0 (- (* y x) y))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 0.8)) {
tmp = x - (-1.0 / y);
} else {
tmp = 1.0 + ((y * 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 <= (-1.0d0)) .or. (.not. (y <= 0.8d0))) then
tmp = x - ((-1.0d0) / y)
else
tmp = 1.0d0 + ((y * x) - y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 0.8)) {
tmp = x - (-1.0 / y);
} else {
tmp = 1.0 + ((y * x) - y);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 0.8): tmp = x - (-1.0 / y) else: tmp = 1.0 + ((y * x) - y) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 0.8)) tmp = Float64(x - Float64(-1.0 / y)); else tmp = Float64(1.0 + Float64(Float64(y * x) - y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.0) || ~((y <= 0.8))) tmp = x - (-1.0 / y); else tmp = 1.0 + ((y * x) - y); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 0.8]], $MachinePrecision]], N[(x - N[(-1.0 / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(y * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 0.8\right):\\
\;\;\;\;x - \frac{-1}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(y \cdot x - y\right)\\
\end{array}
\end{array}
if y < -1 or 0.80000000000000004 < y Initial program 30.6%
sub-neg30.6%
distribute-neg-frac30.6%
neg-mul-130.6%
associate-*l/30.3%
metadata-eval30.3%
associate-*l/30.3%
associate-/r/30.3%
metadata-eval30.3%
distribute-neg-frac30.3%
cancel-sign-sub-inv30.3%
associate-/r/30.5%
associate-/r*30.5%
neg-mul-130.5%
associate-/r/30.3%
distribute-rgt-neg-in30.3%
associate-/r/30.5%
distribute-neg-frac30.5%
metadata-eval30.5%
associate-/r/30.3%
Simplified53.2%
Taylor expanded in y around inf 97.9%
+-commutative97.9%
associate--l+97.9%
div-sub97.9%
sub-neg97.9%
+-commutative97.9%
metadata-eval97.9%
distribute-neg-in97.9%
distribute-neg-frac97.9%
metadata-eval97.9%
sub-neg97.9%
unsub-neg97.9%
sub-neg97.9%
metadata-eval97.9%
Simplified97.9%
Taylor expanded in x around 0 97.7%
if -1 < y < 0.80000000000000004Initial 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 98.1%
sub-neg98.1%
distribute-lft-in98.1%
distribute-rgt-neg-out98.1%
unsub-neg98.1%
*-rgt-identity98.1%
Simplified98.1%
Final simplification97.9%
(FPCore (x y) :precision binary64 (if (<= y -1.0) (- x (/ -1.0 y)) (if (<= y 1.0) (+ 1.0 (- (* y x) y)) (+ x (/ (- 1.0 x) y)))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x - (-1.0 / y);
} else if (y <= 1.0) {
tmp = 1.0 + ((y * x) - y);
} 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 <= (-1.0d0)) then
tmp = x - ((-1.0d0) / y)
else if (y <= 1.0d0) then
tmp = 1.0d0 + ((y * x) - y)
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 <= -1.0) {
tmp = x - (-1.0 / y);
} else if (y <= 1.0) {
tmp = 1.0 + ((y * x) - y);
} else {
tmp = x + ((1.0 - x) / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x - (-1.0 / y) elif y <= 1.0: tmp = 1.0 + ((y * x) - y) else: tmp = x + ((1.0 - x) / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = Float64(x - Float64(-1.0 / y)); elseif (y <= 1.0) tmp = Float64(1.0 + Float64(Float64(y * x) - y)); 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 <= -1.0) tmp = x - (-1.0 / y); elseif (y <= 1.0) tmp = 1.0 + ((y * x) - y); else tmp = x + ((1.0 - x) / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], N[(x - N[(-1.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(1.0 + N[(N[(y * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x - \frac{-1}{y}\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;1 + \left(y \cdot x - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1 - x}{y}\\
\end{array}
\end{array}
if y < -1Initial program 23.2%
sub-neg23.2%
distribute-neg-frac23.2%
neg-mul-123.2%
associate-*l/22.7%
metadata-eval22.7%
associate-*l/22.7%
associate-/r/22.7%
metadata-eval22.7%
distribute-neg-frac22.7%
cancel-sign-sub-inv22.7%
associate-/r/23.1%
associate-/r*23.1%
neg-mul-123.1%
associate-/r/22.7%
distribute-rgt-neg-in22.7%
associate-/r/23.1%
distribute-neg-frac23.1%
metadata-eval23.1%
associate-/r/22.7%
Simplified49.6%
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%
Taylor expanded in x around 0 98.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 98.1%
sub-neg98.1%
distribute-lft-in98.1%
distribute-rgt-neg-out98.1%
unsub-neg98.1%
*-rgt-identity98.1%
Simplified98.1%
if 1 < y Initial program 37.5%
sub-neg37.5%
distribute-neg-frac37.5%
neg-mul-137.5%
associate-*l/37.5%
metadata-eval37.5%
associate-*l/37.5%
associate-/r/37.5%
metadata-eval37.5%
distribute-neg-frac37.5%
cancel-sign-sub-inv37.5%
associate-/r/37.4%
associate-/r*37.4%
neg-mul-137.4%
associate-/r/37.5%
distribute-rgt-neg-in37.5%
associate-/r/37.4%
distribute-neg-frac37.4%
metadata-eval37.4%
associate-/r/37.5%
Simplified56.5%
Taylor expanded in y around inf 97.4%
+-commutative97.4%
associate--l+97.4%
div-sub97.4%
sub-neg97.4%
+-commutative97.4%
metadata-eval97.4%
distribute-neg-in97.4%
distribute-neg-frac97.4%
metadata-eval97.4%
sub-neg97.4%
unsub-neg97.4%
sub-neg97.4%
metadata-eval97.4%
Simplified97.4%
Final simplification98.0%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 0.048))) (- x (/ -1.0 y)) (- 1.0 y)))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 0.048)) {
tmp = x - (-1.0 / y);
} else {
tmp = 1.0 - y;
}
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.048d0))) then
tmp = x - ((-1.0d0) / y)
else
tmp = 1.0d0 - y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 0.048)) {
tmp = x - (-1.0 / y);
} else {
tmp = 1.0 - y;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 0.048): tmp = x - (-1.0 / y) else: tmp = 1.0 - y return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 0.048)) tmp = Float64(x - Float64(-1.0 / y)); else tmp = Float64(1.0 - y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.0) || ~((y <= 0.048))) tmp = x - (-1.0 / y); else tmp = 1.0 - y; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 0.048]], $MachinePrecision]], N[(x - N[(-1.0 / y), $MachinePrecision]), $MachinePrecision], N[(1.0 - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 0.048\right):\\
\;\;\;\;x - \frac{-1}{y}\\
\mathbf{else}:\\
\;\;\;\;1 - y\\
\end{array}
\end{array}
if y < -1 or 0.048000000000000001 < y Initial program 30.6%
sub-neg30.6%
distribute-neg-frac30.6%
neg-mul-130.6%
associate-*l/30.3%
metadata-eval30.3%
associate-*l/30.3%
associate-/r/30.3%
metadata-eval30.3%
distribute-neg-frac30.3%
cancel-sign-sub-inv30.3%
associate-/r/30.5%
associate-/r*30.5%
neg-mul-130.5%
associate-/r/30.3%
distribute-rgt-neg-in30.3%
associate-/r/30.5%
distribute-neg-frac30.5%
metadata-eval30.5%
associate-/r/30.3%
Simplified53.2%
Taylor expanded in y around inf 97.9%
+-commutative97.9%
associate--l+97.9%
div-sub97.9%
sub-neg97.9%
+-commutative97.9%
metadata-eval97.9%
distribute-neg-in97.9%
distribute-neg-frac97.9%
metadata-eval97.9%
sub-neg97.9%
unsub-neg97.9%
sub-neg97.9%
metadata-eval97.9%
Simplified97.9%
Taylor expanded in x around 0 97.7%
if -1 < y < 0.048000000000000001Initial program 100.0%
Taylor expanded in x around 0 74.6%
Taylor expanded in y around 0 74.4%
neg-mul-174.4%
unsub-neg74.4%
Simplified74.4%
Final simplification85.7%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (- x (/ -1.0 y)) (+ 1.0 (* y x))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = x - (-1.0 / y);
} 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 = x - ((-1.0d0) / y)
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 = x - (-1.0 / y);
} else {
tmp = 1.0 + (y * x);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 1.0): tmp = x - (-1.0 / y) else: tmp = 1.0 + (y * x) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.0)) tmp = Float64(x - Float64(-1.0 / y)); 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 = x - (-1.0 / y); 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[(x - N[(-1.0 / y), $MachinePrecision]), $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):\\
\;\;\;\;x - \frac{-1}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot x\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 30.6%
sub-neg30.6%
distribute-neg-frac30.6%
neg-mul-130.6%
associate-*l/30.3%
metadata-eval30.3%
associate-*l/30.3%
associate-/r/30.3%
metadata-eval30.3%
distribute-neg-frac30.3%
cancel-sign-sub-inv30.3%
associate-/r/30.5%
associate-/r*30.5%
neg-mul-130.5%
associate-/r/30.3%
distribute-rgt-neg-in30.3%
associate-/r/30.5%
distribute-neg-frac30.5%
metadata-eval30.5%
associate-/r/30.3%
Simplified53.2%
Taylor expanded in y around inf 97.9%
+-commutative97.9%
associate--l+97.9%
div-sub97.9%
sub-neg97.9%
+-commutative97.9%
metadata-eval97.9%
distribute-neg-in97.9%
distribute-neg-frac97.9%
metadata-eval97.9%
sub-neg97.9%
unsub-neg97.9%
sub-neg97.9%
metadata-eval97.9%
Simplified97.9%
Taylor expanded in x around 0 97.7%
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 x around inf 99.0%
neg-mul-199.0%
distribute-neg-frac99.0%
Simplified99.0%
Taylor expanded in y around 0 97.6%
associate-*r*97.6%
neg-mul-197.6%
Simplified97.6%
Final simplification97.7%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 0.96) (- 1.0 y) x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 0.96) {
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 <= 0.96d0) 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 <= 0.96) {
tmp = 1.0 - y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 0.96: tmp = 1.0 - y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 0.96) 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 <= 0.96) tmp = 1.0 - y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 0.96], N[(1.0 - y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 0.96:\\
\;\;\;\;1 - y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 0.95999999999999996 < y Initial program 30.6%
sub-neg30.6%
distribute-neg-frac30.6%
neg-mul-130.6%
associate-*l/30.3%
metadata-eval30.3%
associate-*l/30.3%
associate-/r/30.3%
metadata-eval30.3%
distribute-neg-frac30.3%
cancel-sign-sub-inv30.3%
associate-/r/30.5%
associate-/r*30.5%
neg-mul-130.5%
associate-/r/30.3%
distribute-rgt-neg-in30.3%
associate-/r/30.5%
distribute-neg-frac30.5%
metadata-eval30.5%
associate-/r/30.3%
Simplified53.2%
Taylor expanded in y around inf 73.6%
if -1 < y < 0.95999999999999996Initial program 100.0%
Taylor expanded in x around 0 74.6%
Taylor expanded in y around 0 74.4%
neg-mul-174.4%
unsub-neg74.4%
Simplified74.4%
Final simplification74.0%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 25000.0) 1.0 x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 25000.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.0d0)) then
tmp = x
else if (y <= 25000.0d0) then
tmp = 1.0d0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 25000.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 25000.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 25000.0) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = x; elseif (y <= 25000.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 25000.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 25000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 25000 < y Initial program 29.7%
sub-neg29.7%
distribute-neg-frac29.7%
neg-mul-129.7%
associate-*l/29.5%
metadata-eval29.5%
associate-*l/29.5%
associate-/r/29.5%
metadata-eval29.5%
distribute-neg-frac29.5%
cancel-sign-sub-inv29.5%
associate-/r/29.6%
associate-/r*29.6%
neg-mul-129.6%
associate-/r/29.5%
distribute-rgt-neg-in29.5%
associate-/r/29.6%
distribute-neg-frac29.6%
metadata-eval29.6%
associate-/r/29.5%
Simplified52.7%
Taylor expanded in y around inf 74.8%
if -1 < y < 25000Initial program 99.7%
sub-neg99.7%
distribute-neg-frac99.7%
neg-mul-199.7%
associate-*l/99.7%
metadata-eval99.7%
associate-*l/99.7%
associate-/r/99.7%
metadata-eval99.7%
distribute-neg-frac99.7%
cancel-sign-sub-inv99.7%
associate-/r/99.7%
associate-/r*99.7%
neg-mul-199.7%
associate-/r/99.7%
distribute-rgt-neg-in99.7%
associate-/r/99.7%
distribute-neg-frac99.7%
metadata-eval99.7%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in y around 0 73.0%
Final simplification73.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 66.4%
sub-neg66.4%
distribute-neg-frac66.4%
neg-mul-166.4%
associate-*l/66.3%
metadata-eval66.3%
associate-*l/66.3%
associate-/r/66.3%
metadata-eval66.3%
distribute-neg-frac66.3%
cancel-sign-sub-inv66.3%
associate-/r/66.3%
associate-/r*66.3%
neg-mul-166.3%
associate-/r/66.3%
distribute-rgt-neg-in66.3%
associate-/r/66.3%
distribute-neg-frac66.3%
metadata-eval66.3%
associate-/r/66.3%
Simplified77.3%
Taylor expanded in y around 0 40.1%
Final simplification40.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 2023182
(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))))