
(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 (/ (+ x -1.0) y)) (t_1 (/ (+ x -1.0) (* y y))))
(if (<= y -1760000.0)
(+ (- x t_0) t_1)
(if (<= y 12000.0)
(+ 1.0 (/ (* y (+ x -1.0)) (+ y 1.0)))
(+ t_1 (+ x (- (/ (- 1.0 x) (pow y 3.0)) t_0)))))))
double code(double x, double y) {
double t_0 = (x + -1.0) / y;
double t_1 = (x + -1.0) / (y * y);
double tmp;
if (y <= -1760000.0) {
tmp = (x - t_0) + t_1;
} else if (y <= 12000.0) {
tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0));
} else {
tmp = t_1 + (x + (((1.0 - x) / pow(y, 3.0)) - 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) :: t_1
real(8) :: tmp
t_0 = (x + (-1.0d0)) / y
t_1 = (x + (-1.0d0)) / (y * y)
if (y <= (-1760000.0d0)) then
tmp = (x - t_0) + t_1
else if (y <= 12000.0d0) then
tmp = 1.0d0 + ((y * (x + (-1.0d0))) / (y + 1.0d0))
else
tmp = t_1 + (x + (((1.0d0 - x) / (y ** 3.0d0)) - t_0))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x + -1.0) / y;
double t_1 = (x + -1.0) / (y * y);
double tmp;
if (y <= -1760000.0) {
tmp = (x - t_0) + t_1;
} else if (y <= 12000.0) {
tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0));
} else {
tmp = t_1 + (x + (((1.0 - x) / Math.pow(y, 3.0)) - t_0));
}
return tmp;
}
def code(x, y): t_0 = (x + -1.0) / y t_1 = (x + -1.0) / (y * y) tmp = 0 if y <= -1760000.0: tmp = (x - t_0) + t_1 elif y <= 12000.0: tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0)) else: tmp = t_1 + (x + (((1.0 - x) / math.pow(y, 3.0)) - t_0)) return tmp
function code(x, y) t_0 = Float64(Float64(x + -1.0) / y) t_1 = Float64(Float64(x + -1.0) / Float64(y * y)) tmp = 0.0 if (y <= -1760000.0) tmp = Float64(Float64(x - t_0) + t_1); elseif (y <= 12000.0) tmp = Float64(1.0 + Float64(Float64(y * Float64(x + -1.0)) / Float64(y + 1.0))); else tmp = Float64(t_1 + Float64(x + Float64(Float64(Float64(1.0 - x) / (y ^ 3.0)) - t_0))); end return tmp end
function tmp_2 = code(x, y) t_0 = (x + -1.0) / y; t_1 = (x + -1.0) / (y * y); tmp = 0.0; if (y <= -1760000.0) tmp = (x - t_0) + t_1; elseif (y <= 12000.0) tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0)); else tmp = t_1 + (x + (((1.0 - x) / (y ^ 3.0)) - t_0)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + -1.0), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1760000.0], N[(N[(x - t$95$0), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[y, 12000.0], N[(1.0 + N[(N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(x + N[(N[(N[(1.0 - x), $MachinePrecision] / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + -1}{y}\\
t_1 := \frac{x + -1}{y \cdot y}\\
\mathbf{if}\;y \leq -1760000:\\
\;\;\;\;\left(x - t_0\right) + t_1\\
\mathbf{elif}\;y \leq 12000:\\
\;\;\;\;1 + \frac{y \cdot \left(x + -1\right)}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(x + \left(\frac{1 - x}{{y}^{3}} - t_0\right)\right)\\
\end{array}
\end{array}
if y < -1.76e6Initial program 23.3%
sub-neg23.3%
distribute-neg-frac23.3%
neg-mul-123.3%
associate-*l/23.0%
metadata-eval23.0%
associate-*l/23.0%
associate-/r/23.0%
metadata-eval23.0%
distribute-neg-frac23.0%
cancel-sign-sub-inv23.0%
associate-/r/23.2%
associate-/r*23.2%
neg-mul-123.2%
associate-/r/23.0%
distribute-rgt-neg-in23.0%
associate-/r/23.2%
distribute-neg-frac23.2%
metadata-eval23.2%
associate-/r/23.0%
Simplified41.2%
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%
if -1.76e6 < y < 12000Initial program 99.9%
if 12000 < y Initial program 33.3%
sub-neg33.3%
distribute-neg-frac33.3%
neg-mul-133.3%
associate-*l/33.3%
metadata-eval33.3%
associate-*l/33.3%
associate-/r/33.3%
metadata-eval33.3%
distribute-neg-frac33.3%
cancel-sign-sub-inv33.3%
associate-/r/33.0%
associate-/r*33.0%
neg-mul-133.0%
associate-/r/33.3%
distribute-rgt-neg-in33.3%
associate-/r/33.0%
distribute-neg-frac33.0%
metadata-eval33.0%
associate-/r/33.3%
Simplified49.1%
Taylor expanded in y around -inf 99.9%
+-commutative99.9%
associate--l+99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (or (<= y -1760000.0) (not (<= y 430000.0))) (+ (- x (/ (+ x -1.0) y)) (/ (+ x -1.0) (* y y))) (+ 1.0 (/ (* y (+ x -1.0)) (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -1760000.0) || !(y <= 430000.0)) {
tmp = (x - ((x + -1.0) / y)) + ((x + -1.0) / (y * 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 <= (-1760000.0d0)) .or. (.not. (y <= 430000.0d0))) then
tmp = (x - ((x + (-1.0d0)) / y)) + ((x + (-1.0d0)) / (y * 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 <= -1760000.0) || !(y <= 430000.0)) {
tmp = (x - ((x + -1.0) / y)) + ((x + -1.0) / (y * y));
} else {
tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1760000.0) or not (y <= 430000.0): tmp = (x - ((x + -1.0) / y)) + ((x + -1.0) / (y * y)) else: tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1760000.0) || !(y <= 430000.0)) tmp = Float64(Float64(x - Float64(Float64(x + -1.0) / y)) + Float64(Float64(x + -1.0) / Float64(y * 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 <= -1760000.0) || ~((y <= 430000.0))) tmp = (x - ((x + -1.0) / y)) + ((x + -1.0) / (y * y)); else tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1760000.0], N[Not[LessEqual[y, 430000.0]], $MachinePrecision]], N[(N[(x - N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + N[(N[(x + -1.0), $MachinePrecision] / N[(y * y), $MachinePrecision]), $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 -1760000 \lor \neg \left(y \leq 430000\right):\\
\;\;\;\;\left(x - \frac{x + -1}{y}\right) + \frac{x + -1}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y \cdot \left(x + -1\right)}{y + 1}\\
\end{array}
\end{array}
if y < -1.76e6 or 4.3e5 < y Initial program 28.2%
sub-neg28.2%
distribute-neg-frac28.2%
neg-mul-128.2%
associate-*l/28.1%
metadata-eval28.1%
associate-*l/28.1%
associate-/r/28.1%
metadata-eval28.1%
distribute-neg-frac28.1%
cancel-sign-sub-inv28.1%
associate-/r/28.0%
associate-/r*28.0%
neg-mul-128.0%
associate-/r/28.1%
distribute-rgt-neg-in28.1%
associate-/r/28.0%
distribute-neg-frac28.0%
metadata-eval28.0%
associate-/r/28.1%
Simplified45.2%
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%
if -1.76e6 < y < 4.3e5Initial program 99.7%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (or (<= y -135000000.0) (not (<= y 450000000.0))) (- x (/ (+ x -1.0) y)) (+ 1.0 (* y (/ (+ x -1.0) (+ y 1.0))))))
double code(double x, double y) {
double tmp;
if ((y <= -135000000.0) || !(y <= 450000000.0)) {
tmp = x - ((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 <= (-135000000.0d0)) .or. (.not. (y <= 450000000.0d0))) then
tmp = x - ((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 <= -135000000.0) || !(y <= 450000000.0)) {
tmp = x - ((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 <= -135000000.0) or not (y <= 450000000.0): tmp = x - ((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 <= -135000000.0) || !(y <= 450000000.0)) tmp = Float64(x - Float64(Float64(x + -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 <= -135000000.0) || ~((y <= 450000000.0))) tmp = x - ((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, -135000000.0], N[Not[LessEqual[y, 450000000.0]], $MachinePrecision]], N[(x - N[(N[(x + -1.0), $MachinePrecision] / 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 -135000000 \lor \neg \left(y \leq 450000000\right):\\
\;\;\;\;x - \frac{x + -1}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\
\end{array}
\end{array}
if y < -1.35e8 or 4.5e8 < y Initial program 27.9%
sub-neg27.9%
distribute-neg-frac27.9%
neg-mul-127.9%
associate-*l/27.8%
metadata-eval27.8%
associate-*l/27.8%
associate-/r/27.8%
metadata-eval27.8%
distribute-neg-frac27.8%
cancel-sign-sub-inv27.8%
associate-/r/27.8%
associate-/r*27.8%
neg-mul-127.8%
associate-/r/27.8%
distribute-rgt-neg-in27.8%
associate-/r/27.8%
distribute-neg-frac27.8%
metadata-eval27.8%
associate-/r/27.8%
Simplified45.0%
Taylor expanded in y around inf 99.5%
+-commutative99.5%
associate--l+99.5%
div-sub99.5%
sub-neg99.5%
+-commutative99.5%
metadata-eval99.5%
distribute-neg-in99.5%
distribute-neg-frac99.5%
metadata-eval99.5%
sub-neg99.5%
unsub-neg99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
if -1.35e8 < y < 4.5e8Initial program 99.5%
sub-neg99.5%
distribute-neg-frac99.5%
neg-mul-199.5%
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.3%
associate-/r*99.3%
neg-mul-199.3%
associate-/r/99.4%
distribute-rgt-neg-in99.4%
associate-/r/99.3%
distribute-neg-frac99.3%
metadata-eval99.3%
associate-/r/99.4%
Simplified99.4%
Final simplification99.5%
(FPCore (x y) :precision binary64 (if (or (<= y -68000000.0) (not (<= y 330000000.0))) (- x (/ (+ x -1.0) y)) (+ 1.0 (/ (* y (+ x -1.0)) (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -68000000.0) || !(y <= 330000000.0)) {
tmp = x - ((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 <= (-68000000.0d0)) .or. (.not. (y <= 330000000.0d0))) then
tmp = x - ((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 <= -68000000.0) || !(y <= 330000000.0)) {
tmp = x - ((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 <= -68000000.0) or not (y <= 330000000.0): tmp = x - ((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 <= -68000000.0) || !(y <= 330000000.0)) tmp = Float64(x - Float64(Float64(x + -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 <= -68000000.0) || ~((y <= 330000000.0))) tmp = x - ((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, -68000000.0], N[Not[LessEqual[y, 330000000.0]], $MachinePrecision]], N[(x - N[(N[(x + -1.0), $MachinePrecision] / 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 -68000000 \lor \neg \left(y \leq 330000000\right):\\
\;\;\;\;x - \frac{x + -1}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y \cdot \left(x + -1\right)}{y + 1}\\
\end{array}
\end{array}
if y < -6.8e7 or 3.3e8 < y Initial program 27.9%
sub-neg27.9%
distribute-neg-frac27.9%
neg-mul-127.9%
associate-*l/27.8%
metadata-eval27.8%
associate-*l/27.8%
associate-/r/27.8%
metadata-eval27.8%
distribute-neg-frac27.8%
cancel-sign-sub-inv27.8%
associate-/r/27.8%
associate-/r*27.8%
neg-mul-127.8%
associate-/r/27.8%
distribute-rgt-neg-in27.8%
associate-/r/27.8%
distribute-neg-frac27.8%
metadata-eval27.8%
associate-/r/27.8%
Simplified45.0%
Taylor expanded in y around inf 99.5%
+-commutative99.5%
associate--l+99.5%
div-sub99.5%
sub-neg99.5%
+-commutative99.5%
metadata-eval99.5%
distribute-neg-in99.5%
distribute-neg-frac99.5%
metadata-eval99.5%
sub-neg99.5%
unsub-neg99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
if -6.8e7 < y < 3.3e8Initial program 99.5%
Final simplification99.5%
(FPCore (x y)
:precision binary64
(if (<= y -8.5e+112)
x
(if (<= y -1.0)
(/ 1.0 y)
(if (<= y 2.0) (+ 1.0 (- (* y x) y)) (if (<= y 9.5e+34) (/ 1.0 y) x)))))
double code(double x, double y) {
double tmp;
if (y <= -8.5e+112) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= 2.0) {
tmp = 1.0 + ((y * x) - y);
} else if (y <= 9.5e+34) {
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 <= (-8.5d+112)) then
tmp = x
else if (y <= (-1.0d0)) then
tmp = 1.0d0 / y
else if (y <= 2.0d0) then
tmp = 1.0d0 + ((y * x) - y)
else if (y <= 9.5d+34) 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 <= -8.5e+112) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= 2.0) {
tmp = 1.0 + ((y * x) - y);
} else if (y <= 9.5e+34) {
tmp = 1.0 / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -8.5e+112: tmp = x elif y <= -1.0: tmp = 1.0 / y elif y <= 2.0: tmp = 1.0 + ((y * x) - y) elif y <= 9.5e+34: tmp = 1.0 / y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -8.5e+112) tmp = x; elseif (y <= -1.0) tmp = Float64(1.0 / y); elseif (y <= 2.0) tmp = Float64(1.0 + Float64(Float64(y * x) - y)); elseif (y <= 9.5e+34) tmp = Float64(1.0 / y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -8.5e+112) tmp = x; elseif (y <= -1.0) tmp = 1.0 / y; elseif (y <= 2.0) tmp = 1.0 + ((y * x) - y); elseif (y <= 9.5e+34) tmp = 1.0 / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -8.5e+112], x, If[LessEqual[y, -1.0], N[(1.0 / y), $MachinePrecision], If[LessEqual[y, 2.0], N[(1.0 + N[(N[(y * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.5e+34], N[(1.0 / y), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{+112}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{elif}\;y \leq 2:\\
\;\;\;\;1 + \left(y \cdot x - y\right)\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{+34}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -8.50000000000000047e112 or 9.4999999999999999e34 < y Initial program 26.7%
sub-neg26.7%
distribute-neg-frac26.7%
neg-mul-126.7%
associate-*l/26.8%
metadata-eval26.8%
associate-*l/26.8%
associate-/r/26.8%
metadata-eval26.8%
distribute-neg-frac26.8%
cancel-sign-sub-inv26.8%
associate-/r/26.6%
associate-/r*26.6%
neg-mul-126.6%
associate-/r/26.8%
distribute-rgt-neg-in26.8%
associate-/r/26.6%
distribute-neg-frac26.6%
metadata-eval26.6%
associate-/r/26.8%
Simplified47.8%
Taylor expanded in y around inf 81.3%
if -8.50000000000000047e112 < y < -1 or 2 < y < 9.4999999999999999e34Initial program 40.8%
Taylor expanded in x around 0 15.9%
Taylor expanded in y around inf 65.5%
if -1 < y < 2Initial 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%
Simplified99.9%
Taylor expanded in y around 0 97.3%
sub-neg97.3%
distribute-lft-in97.3%
distribute-rgt-neg-out97.3%
unsub-neg97.3%
*-rgt-identity97.3%
Simplified97.3%
Final simplification88.0%
(FPCore (x y) :precision binary64 (if (or (<= y -360.0) (not (<= y 64000.0))) (- x (/ (+ x -1.0) y)) (+ 1.0 (* y (/ x (+ y 1.0))))))
double code(double x, double y) {
double tmp;
if ((y <= -360.0) || !(y <= 64000.0)) {
tmp = x - ((x + -1.0) / y);
} else {
tmp = 1.0 + (y * (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 <= (-360.0d0)) .or. (.not. (y <= 64000.0d0))) then
tmp = x - ((x + (-1.0d0)) / y)
else
tmp = 1.0d0 + (y * (x / (y + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -360.0) || !(y <= 64000.0)) {
tmp = x - ((x + -1.0) / y);
} else {
tmp = 1.0 + (y * (x / (y + 1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -360.0) or not (y <= 64000.0): tmp = x - ((x + -1.0) / y) else: tmp = 1.0 + (y * (x / (y + 1.0))) return tmp
function code(x, y) tmp = 0.0 if ((y <= -360.0) || !(y <= 64000.0)) tmp = Float64(x - Float64(Float64(x + -1.0) / y)); else tmp = Float64(1.0 + Float64(y * Float64(x / Float64(y + 1.0)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -360.0) || ~((y <= 64000.0))) tmp = x - ((x + -1.0) / y); else tmp = 1.0 + (y * (x / (y + 1.0))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -360.0], N[Not[LessEqual[y, 64000.0]], $MachinePrecision]], N[(x - N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -360 \lor \neg \left(y \leq 64000\right):\\
\;\;\;\;x - \frac{x + -1}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{x}{y + 1}\\
\end{array}
\end{array}
if y < -360 or 64000 < y Initial program 29.7%
sub-neg29.7%
distribute-neg-frac29.7%
neg-mul-129.7%
associate-*l/29.6%
metadata-eval29.6%
associate-*l/29.6%
associate-/r/29.6%
metadata-eval29.6%
distribute-neg-frac29.6%
cancel-sign-sub-inv29.6%
associate-/r/29.4%
associate-/r*29.4%
neg-mul-129.4%
associate-/r/29.6%
distribute-rgt-neg-in29.6%
associate-/r/29.4%
distribute-neg-frac29.4%
metadata-eval29.4%
associate-/r/29.6%
Simplified46.2%
Taylor expanded in y around inf 98.0%
+-commutative98.0%
associate--l+98.0%
div-sub98.0%
sub-neg98.0%
+-commutative98.0%
metadata-eval98.0%
distribute-neg-in98.0%
distribute-neg-frac98.0%
metadata-eval98.0%
sub-neg98.0%
unsub-neg98.0%
sub-neg98.0%
metadata-eval98.0%
Simplified98.0%
if -360 < y < 64000Initial 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%
Simplified99.9%
Taylor expanded in x around inf 99.4%
neg-mul-199.4%
distribute-neg-frac99.4%
Simplified99.4%
Final simplification98.7%
(FPCore (x y)
:precision binary64
(if (<= y -2.15e+114)
x
(if (<= y -0.01)
(/ 1.0 y)
(if (<= y 9e-6) (- 1.0 y) (if (<= y 1.55e+35) (/ 1.0 y) x)))))
double code(double x, double y) {
double tmp;
if (y <= -2.15e+114) {
tmp = x;
} else if (y <= -0.01) {
tmp = 1.0 / y;
} else if (y <= 9e-6) {
tmp = 1.0 - y;
} else if (y <= 1.55e+35) {
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 <= (-2.15d+114)) then
tmp = x
else if (y <= (-0.01d0)) then
tmp = 1.0d0 / y
else if (y <= 9d-6) then
tmp = 1.0d0 - y
else if (y <= 1.55d+35) 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 <= -2.15e+114) {
tmp = x;
} else if (y <= -0.01) {
tmp = 1.0 / y;
} else if (y <= 9e-6) {
tmp = 1.0 - y;
} else if (y <= 1.55e+35) {
tmp = 1.0 / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.15e+114: tmp = x elif y <= -0.01: tmp = 1.0 / y elif y <= 9e-6: tmp = 1.0 - y elif y <= 1.55e+35: tmp = 1.0 / y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -2.15e+114) tmp = x; elseif (y <= -0.01) tmp = Float64(1.0 / y); elseif (y <= 9e-6) tmp = Float64(1.0 - y); elseif (y <= 1.55e+35) tmp = Float64(1.0 / y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2.15e+114) tmp = x; elseif (y <= -0.01) tmp = 1.0 / y; elseif (y <= 9e-6) tmp = 1.0 - y; elseif (y <= 1.55e+35) tmp = 1.0 / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.15e+114], x, If[LessEqual[y, -0.01], N[(1.0 / y), $MachinePrecision], If[LessEqual[y, 9e-6], N[(1.0 - y), $MachinePrecision], If[LessEqual[y, 1.55e+35], N[(1.0 / y), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.15 \cdot 10^{+114}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -0.01:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{elif}\;y \leq 9 \cdot 10^{-6}:\\
\;\;\;\;1 - y\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{+35}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.15e114 or 1.54999999999999993e35 < y Initial program 26.7%
sub-neg26.7%
distribute-neg-frac26.7%
neg-mul-126.7%
associate-*l/26.8%
metadata-eval26.8%
associate-*l/26.8%
associate-/r/26.8%
metadata-eval26.8%
distribute-neg-frac26.8%
cancel-sign-sub-inv26.8%
associate-/r/26.6%
associate-/r*26.6%
neg-mul-126.6%
associate-/r/26.8%
distribute-rgt-neg-in26.8%
associate-/r/26.6%
distribute-neg-frac26.6%
metadata-eval26.6%
associate-/r/26.8%
Simplified47.8%
Taylor expanded in y around inf 81.3%
if -2.15e114 < y < -0.0100000000000000002 or 9.00000000000000023e-6 < y < 1.54999999999999993e35Initial program 46.9%
Taylor expanded in x around 0 14.5%
Taylor expanded in y around inf 59.2%
if -0.0100000000000000002 < y < 9.00000000000000023e-6Initial program 100.0%
Taylor expanded in x around 0 77.0%
Taylor expanded in y around 0 77.0%
neg-mul-177.0%
unsub-neg77.0%
Simplified77.0%
Final simplification76.6%
(FPCore (x y)
:precision binary64
(if (<= y -7.5e+112)
x
(if (<= y -1.0)
(/ 1.0 y)
(if (<= y 50.0) (+ 1.0 (* y x)) (if (<= y 1.05e+35) (/ 1.0 y) x)))))
double code(double x, double y) {
double tmp;
if (y <= -7.5e+112) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= 50.0) {
tmp = 1.0 + (y * x);
} else if (y <= 1.05e+35) {
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 <= (-7.5d+112)) then
tmp = x
else if (y <= (-1.0d0)) then
tmp = 1.0d0 / y
else if (y <= 50.0d0) then
tmp = 1.0d0 + (y * x)
else if (y <= 1.05d+35) 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 <= -7.5e+112) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= 50.0) {
tmp = 1.0 + (y * x);
} else if (y <= 1.05e+35) {
tmp = 1.0 / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7.5e+112: tmp = x elif y <= -1.0: tmp = 1.0 / y elif y <= 50.0: tmp = 1.0 + (y * x) elif y <= 1.05e+35: tmp = 1.0 / y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -7.5e+112) tmp = x; elseif (y <= -1.0) tmp = Float64(1.0 / y); elseif (y <= 50.0) tmp = Float64(1.0 + Float64(y * x)); elseif (y <= 1.05e+35) tmp = Float64(1.0 / y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -7.5e+112) tmp = x; elseif (y <= -1.0) tmp = 1.0 / y; elseif (y <= 50.0) tmp = 1.0 + (y * x); elseif (y <= 1.05e+35) tmp = 1.0 / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7.5e+112], x, If[LessEqual[y, -1.0], N[(1.0 / y), $MachinePrecision], If[LessEqual[y, 50.0], N[(1.0 + N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.05e+35], N[(1.0 / y), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+112}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{elif}\;y \leq 50:\\
\;\;\;\;1 + y \cdot x\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{+35}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -7.5e112 or 1.0499999999999999e35 < y Initial program 26.7%
sub-neg26.7%
distribute-neg-frac26.7%
neg-mul-126.7%
associate-*l/26.8%
metadata-eval26.8%
associate-*l/26.8%
associate-/r/26.8%
metadata-eval26.8%
distribute-neg-frac26.8%
cancel-sign-sub-inv26.8%
associate-/r/26.6%
associate-/r*26.6%
neg-mul-126.6%
associate-/r/26.8%
distribute-rgt-neg-in26.8%
associate-/r/26.6%
distribute-neg-frac26.6%
metadata-eval26.6%
associate-/r/26.8%
Simplified47.8%
Taylor expanded in y around inf 81.3%
if -7.5e112 < y < -1 or 50 < y < 1.0499999999999999e35Initial program 40.8%
Taylor expanded in x around 0 15.9%
Taylor expanded in y around inf 65.5%
if -1 < y < 50Initial 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%
Simplified99.9%
Taylor expanded in x around inf 99.4%
neg-mul-199.4%
distribute-neg-frac99.4%
Simplified99.4%
Taylor expanded in y around 0 96.8%
associate-*r*96.8%
neg-mul-196.8%
Simplified96.8%
Final simplification87.7%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (- x (/ (+ x -1.0) y)) (+ 1.0 (- (* y x) y))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = x - ((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 <= 1.0d0))) then
tmp = x - ((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 <= 1.0)) {
tmp = x - ((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 <= 1.0): tmp = x - ((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 <= 1.0)) tmp = Float64(x - Float64(Float64(x + -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 <= 1.0))) tmp = x - ((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, 1.0]], $MachinePrecision]], N[(x - N[(N[(x + -1.0), $MachinePrecision] / 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 1\right):\\
\;\;\;\;x - \frac{x + -1}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(y \cdot x - y\right)\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 29.7%
sub-neg29.7%
distribute-neg-frac29.7%
neg-mul-129.7%
associate-*l/29.6%
metadata-eval29.6%
associate-*l/29.6%
associate-/r/29.6%
metadata-eval29.6%
distribute-neg-frac29.6%
cancel-sign-sub-inv29.6%
associate-/r/29.4%
associate-/r*29.4%
neg-mul-129.4%
associate-/r/29.6%
distribute-rgt-neg-in29.6%
associate-/r/29.4%
distribute-neg-frac29.4%
metadata-eval29.4%
associate-/r/29.6%
Simplified46.2%
Taylor expanded in y around inf 98.0%
+-commutative98.0%
associate--l+98.0%
div-sub98.0%
sub-neg98.0%
+-commutative98.0%
metadata-eval98.0%
distribute-neg-in98.0%
distribute-neg-frac98.0%
metadata-eval98.0%
sub-neg98.0%
unsub-neg98.0%
sub-neg98.0%
metadata-eval98.0%
Simplified98.0%
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%
Simplified99.9%
Taylor expanded in y around 0 97.3%
sub-neg97.3%
distribute-lft-in97.3%
distribute-rgt-neg-out97.3%
unsub-neg97.3%
*-rgt-identity97.3%
Simplified97.3%
Final simplification97.7%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 1.42e-8) (- 1.0 y) x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 1.42e-8) {
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 <= 1.42d-8) 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 <= 1.42e-8) {
tmp = 1.0 - y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 1.42e-8: tmp = 1.0 - y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 1.42e-8) 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 <= 1.42e-8) tmp = 1.0 - y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 1.42e-8], N[(1.0 - y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.42 \cdot 10^{-8}:\\
\;\;\;\;1 - y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 1.41999999999999998e-8 < y Initial program 31.9%
sub-neg31.9%
distribute-neg-frac31.9%
neg-mul-131.9%
associate-*l/31.7%
metadata-eval31.7%
associate-*l/31.7%
associate-/r/31.7%
metadata-eval31.7%
distribute-neg-frac31.7%
cancel-sign-sub-inv31.7%
associate-/r/31.7%
associate-/r*31.7%
neg-mul-131.7%
associate-/r/31.7%
distribute-rgt-neg-in31.7%
associate-/r/31.7%
distribute-neg-frac31.7%
metadata-eval31.7%
associate-/r/31.7%
Simplified47.9%
Taylor expanded in y around inf 68.2%
if -1 < y < 1.41999999999999998e-8Initial program 100.0%
Taylor expanded in x around 0 77.6%
Taylor expanded in y around 0 77.6%
neg-mul-177.6%
unsub-neg77.6%
Simplified77.6%
Final simplification72.9%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 1.42e-8) 1.0 x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 1.42e-8) {
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 <= 1.42d-8) 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 <= 1.42e-8) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 1.42e-8: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 1.42e-8) 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 <= 1.42e-8) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 1.42e-8], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.42 \cdot 10^{-8}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 1.41999999999999998e-8 < y Initial program 31.9%
sub-neg31.9%
distribute-neg-frac31.9%
neg-mul-131.9%
associate-*l/31.7%
metadata-eval31.7%
associate-*l/31.7%
associate-/r/31.7%
metadata-eval31.7%
distribute-neg-frac31.7%
cancel-sign-sub-inv31.7%
associate-/r/31.7%
associate-/r*31.7%
neg-mul-131.7%
associate-/r/31.7%
distribute-rgt-neg-in31.7%
associate-/r/31.7%
distribute-neg-frac31.7%
metadata-eval31.7%
associate-/r/31.7%
Simplified47.9%
Taylor expanded in y around inf 68.2%
if -1 < y < 1.41999999999999998e-8Initial 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 77.0%
Final simplification72.6%
(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.9%
sub-neg65.9%
distribute-neg-frac65.9%
neg-mul-165.9%
associate-*l/65.9%
metadata-eval65.9%
associate-*l/65.9%
associate-/r/65.9%
metadata-eval65.9%
distribute-neg-frac65.9%
cancel-sign-sub-inv65.9%
associate-/r/65.8%
associate-/r*65.8%
neg-mul-165.8%
associate-/r/65.9%
distribute-rgt-neg-in65.9%
associate-/r/65.8%
distribute-neg-frac65.8%
metadata-eval65.8%
associate-/r/65.9%
Simplified73.9%
Taylor expanded in y around 0 40.3%
Final simplification40.3%
(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 2023238
(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))))