
(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 15 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) (+ 1.0 y))))
(if (<= t_0 0.9998)
(fma (/ y (+ 1.0 y)) (+ x -1.0) 1.0)
(if (<= t_0 2.0)
(-
(/ (+ x -1.0) (* y y))
(- (/ (+ x -1.0) y) (+ x (/ (- 1.0 x) (pow y 3.0)))))
(- 1.0 (/ x (/ (- -1.0 y) y)))))))
double code(double x, double y) {
double t_0 = ((1.0 - x) * y) / (1.0 + y);
double tmp;
if (t_0 <= 0.9998) {
tmp = fma((y / (1.0 + y)), (x + -1.0), 1.0);
} else if (t_0 <= 2.0) {
tmp = ((x + -1.0) / (y * y)) - (((x + -1.0) / y) - (x + ((1.0 - x) / pow(y, 3.0))));
} else {
tmp = 1.0 - (x / ((-1.0 - y) / y));
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(Float64(1.0 - x) * y) / Float64(1.0 + y)) tmp = 0.0 if (t_0 <= 0.9998) tmp = fma(Float64(y / Float64(1.0 + y)), Float64(x + -1.0), 1.0); elseif (t_0 <= 2.0) tmp = Float64(Float64(Float64(x + -1.0) / Float64(y * y)) - Float64(Float64(Float64(x + -1.0) / y) - Float64(x + Float64(Float64(1.0 - x) / (y ^ 3.0))))); else tmp = Float64(1.0 - Float64(x / Float64(Float64(-1.0 - y) / y))); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.9998], N[(N[(y / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] * N[(x + -1.0), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(N[(N[(x + -1.0), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision] - N[(x + N[(N[(1.0 - x), $MachinePrecision] / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(N[(-1.0 - y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(1 - x\right) \cdot y}{1 + y}\\
\mathbf{if}\;t_0 \leq 0.9998:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{1 + y}, x + -1, 1\right)\\
\mathbf{elif}\;t_0 \leq 2:\\
\;\;\;\;\frac{x + -1}{y \cdot y} - \left(\frac{x + -1}{y} - \left(x + \frac{1 - x}{{y}^{3}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{\frac{-1 - y}{y}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)) < 0.99980000000000002Initial program 90.4%
sub-neg90.4%
+-commutative90.4%
associate-/l*99.9%
distribute-neg-frac99.9%
*-lft-identity99.9%
associate-*l/99.9%
fma-def99.9%
associate-/l*99.9%
*-lft-identity99.9%
+-commutative99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
if 0.99980000000000002 < (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)) < 2Initial program 7.1%
sub-neg7.1%
distribute-neg-frac7.1%
neg-mul-17.1%
associate-*l/7.0%
metadata-eval7.0%
associate-*l/7.0%
associate-/r/7.0%
metadata-eval7.0%
distribute-neg-frac7.0%
cancel-sign-sub-inv7.0%
associate-/r/7.1%
associate-/r*7.1%
neg-mul-17.1%
associate-/r/7.0%
distribute-rgt-neg-in7.0%
associate-/r/7.1%
distribute-neg-frac7.1%
metadata-eval7.1%
associate-/r/7.0%
Simplified7.0%
Taylor expanded in y around -inf 100.0%
+-commutative100.0%
associate--l+100.0%
Simplified100.0%
if 2 < (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)) Initial program 64.6%
sub-neg64.6%
distribute-neg-frac64.6%
neg-mul-164.6%
associate-*l/64.5%
metadata-eval64.5%
associate-*l/64.5%
associate-/r/64.5%
metadata-eval64.5%
distribute-neg-frac64.5%
cancel-sign-sub-inv64.5%
associate-/r/64.4%
associate-/r*64.4%
neg-mul-164.4%
associate-/r/64.5%
distribute-rgt-neg-in64.5%
associate-/r/64.4%
distribute-neg-frac64.4%
metadata-eval64.4%
associate-/r/64.5%
Simplified99.9%
Taylor expanded in x around inf 99.9%
neg-mul-199.9%
distribute-neg-frac99.9%
Simplified99.9%
frac-2neg99.9%
remove-double-neg99.9%
associate-*l/64.6%
distribute-neg-in64.6%
metadata-eval64.6%
Applied egg-rr64.6%
associate-/l*100.0%
unsub-neg100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* (- 1.0 x) y) (+ 1.0 y))))
(if (<= t_0 0.9998)
(fma (/ y (+ 1.0 y)) (+ x -1.0) 1.0)
(if (<= t_0 2.0)
(+ (/ (+ x -1.0) (* y y)) (+ x (/ (- 1.0 x) y)))
(- 1.0 (/ x (/ (- -1.0 y) y)))))))
double code(double x, double y) {
double t_0 = ((1.0 - x) * y) / (1.0 + y);
double tmp;
if (t_0 <= 0.9998) {
tmp = fma((y / (1.0 + y)), (x + -1.0), 1.0);
} else if (t_0 <= 2.0) {
tmp = ((x + -1.0) / (y * y)) + (x + ((1.0 - x) / y));
} else {
tmp = 1.0 - (x / ((-1.0 - y) / y));
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(Float64(1.0 - x) * y) / Float64(1.0 + y)) tmp = 0.0 if (t_0 <= 0.9998) tmp = fma(Float64(y / Float64(1.0 + y)), Float64(x + -1.0), 1.0); elseif (t_0 <= 2.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(x / Float64(Float64(-1.0 - y) / y))); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.9998], N[(N[(y / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] * N[(x + -1.0), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[t$95$0, 2.0], 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[(x / N[(N[(-1.0 - y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\left(1 - x\right) \cdot y}{1 + y}\\
\mathbf{if}\;t_0 \leq 0.9998:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{1 + y}, x + -1, 1\right)\\
\mathbf{elif}\;t_0 \leq 2:\\
\;\;\;\;\frac{x + -1}{y \cdot y} + \left(x + \frac{1 - x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{\frac{-1 - y}{y}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)) < 0.99980000000000002Initial program 90.4%
sub-neg90.4%
+-commutative90.4%
associate-/l*99.9%
distribute-neg-frac99.9%
*-lft-identity99.9%
associate-*l/99.9%
fma-def99.9%
associate-/l*99.9%
*-lft-identity99.9%
+-commutative99.9%
neg-sub099.9%
associate--r-99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
if 0.99980000000000002 < (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)) < 2Initial program 7.1%
sub-neg7.1%
distribute-neg-frac7.1%
neg-mul-17.1%
associate-*l/7.0%
metadata-eval7.0%
associate-*l/7.0%
associate-/r/7.0%
metadata-eval7.0%
distribute-neg-frac7.0%
cancel-sign-sub-inv7.0%
associate-/r/7.1%
associate-/r*7.1%
neg-mul-17.1%
associate-/r/7.0%
distribute-rgt-neg-in7.0%
associate-/r/7.1%
distribute-neg-frac7.1%
metadata-eval7.1%
associate-/r/7.0%
Simplified7.0%
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 < (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)) Initial program 64.6%
sub-neg64.6%
distribute-neg-frac64.6%
neg-mul-164.6%
associate-*l/64.5%
metadata-eval64.5%
associate-*l/64.5%
associate-/r/64.5%
metadata-eval64.5%
distribute-neg-frac64.5%
cancel-sign-sub-inv64.5%
associate-/r/64.4%
associate-/r*64.4%
neg-mul-164.4%
associate-/r/64.5%
distribute-rgt-neg-in64.5%
associate-/r/64.4%
distribute-neg-frac64.4%
metadata-eval64.4%
associate-/r/64.5%
Simplified99.9%
Taylor expanded in x around inf 99.9%
neg-mul-199.9%
distribute-neg-frac99.9%
Simplified99.9%
frac-2neg99.9%
remove-double-neg99.9%
associate-*l/64.6%
distribute-neg-in64.6%
metadata-eval64.6%
Applied egg-rr64.6%
associate-/l*100.0%
unsub-neg100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ x (/ (- 1.0 x) y))))
(if (<= y -242000.0)
(+ (/ (+ x -1.0) (* y y)) t_0)
(if (<= y 120000000.0) (+ 1.0 (* y (/ (+ x -1.0) (+ 1.0 y)))) t_0))))
double code(double x, double y) {
double t_0 = x + ((1.0 - x) / y);
double tmp;
if (y <= -242000.0) {
tmp = ((x + -1.0) / (y * y)) + t_0;
} else if (y <= 120000000.0) {
tmp = 1.0 + (y * ((x + -1.0) / (1.0 + y)));
} 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 = x + ((1.0d0 - x) / y)
if (y <= (-242000.0d0)) then
tmp = ((x + (-1.0d0)) / (y * y)) + t_0
else if (y <= 120000000.0d0) then
tmp = 1.0d0 + (y * ((x + (-1.0d0)) / (1.0d0 + y)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x + ((1.0 - x) / y);
double tmp;
if (y <= -242000.0) {
tmp = ((x + -1.0) / (y * y)) + t_0;
} else if (y <= 120000000.0) {
tmp = 1.0 + (y * ((x + -1.0) / (1.0 + y)));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x + ((1.0 - x) / y) tmp = 0 if y <= -242000.0: tmp = ((x + -1.0) / (y * y)) + t_0 elif y <= 120000000.0: tmp = 1.0 + (y * ((x + -1.0) / (1.0 + y))) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x + Float64(Float64(1.0 - x) / y)) tmp = 0.0 if (y <= -242000.0) tmp = Float64(Float64(Float64(x + -1.0) / Float64(y * y)) + t_0); elseif (y <= 120000000.0) tmp = Float64(1.0 + Float64(y * Float64(Float64(x + -1.0) / Float64(1.0 + y)))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = x + ((1.0 - x) / y); tmp = 0.0; if (y <= -242000.0) tmp = ((x + -1.0) / (y * y)) + t_0; elseif (y <= 120000000.0) tmp = 1.0 + (y * ((x + -1.0) / (1.0 + y))); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -242000.0], N[(N[(N[(x + -1.0), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], If[LessEqual[y, 120000000.0], N[(1.0 + N[(y * N[(N[(x + -1.0), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \frac{1 - x}{y}\\
\mathbf{if}\;y \leq -242000:\\
\;\;\;\;\frac{x + -1}{y \cdot y} + t_0\\
\mathbf{elif}\;y \leq 120000000:\\
\;\;\;\;1 + y \cdot \frac{x + -1}{1 + y}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -242000Initial program 24.3%
sub-neg24.3%
distribute-neg-frac24.3%
neg-mul-124.3%
associate-*l/24.1%
metadata-eval24.1%
associate-*l/24.1%
associate-/r/24.1%
metadata-eval24.1%
distribute-neg-frac24.1%
cancel-sign-sub-inv24.1%
associate-/r/24.2%
associate-/r*24.2%
neg-mul-124.2%
associate-/r/24.1%
distribute-rgt-neg-in24.1%
associate-/r/24.2%
distribute-neg-frac24.2%
metadata-eval24.2%
associate-/r/24.1%
Simplified50.6%
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 -242000 < y < 1.2e8Initial 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.8%
associate-/r*99.8%
neg-mul-199.8%
associate-/r/99.9%
distribute-rgt-neg-in99.9%
associate-/r/99.8%
distribute-neg-frac99.8%
metadata-eval99.8%
associate-/r/99.9%
Simplified99.9%
if 1.2e8 < y Initial program 40.2%
sub-neg40.2%
distribute-neg-frac40.2%
neg-mul-140.2%
associate-*l/40.1%
metadata-eval40.1%
associate-*l/40.1%
associate-/r/40.1%
metadata-eval40.1%
distribute-neg-frac40.1%
cancel-sign-sub-inv40.1%
associate-/r/40.0%
associate-/r*40.0%
neg-mul-140.0%
associate-/r/40.1%
distribute-rgt-neg-in40.1%
associate-/r/40.0%
distribute-neg-frac40.0%
metadata-eval40.0%
associate-/r/40.1%
Simplified63.3%
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.9%
(FPCore (x y) :precision binary64 (if (or (<= y -380000000000.0) (not (<= y 120000000.0))) (+ x (/ (- 1.0 x) y)) (+ 1.0 (* y (/ (+ x -1.0) (+ 1.0 y))))))
double code(double x, double y) {
double tmp;
if ((y <= -380000000000.0) || !(y <= 120000000.0)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 + (y * ((x + -1.0) / (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 <= (-380000000000.0d0)) .or. (.not. (y <= 120000000.0d0))) then
tmp = x + ((1.0d0 - x) / y)
else
tmp = 1.0d0 + (y * ((x + (-1.0d0)) / (1.0d0 + y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -380000000000.0) || !(y <= 120000000.0)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 + (y * ((x + -1.0) / (1.0 + y)));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -380000000000.0) or not (y <= 120000000.0): tmp = x + ((1.0 - x) / y) else: tmp = 1.0 + (y * ((x + -1.0) / (1.0 + y))) return tmp
function code(x, y) tmp = 0.0 if ((y <= -380000000000.0) || !(y <= 120000000.0)) tmp = Float64(x + Float64(Float64(1.0 - x) / y)); else tmp = Float64(1.0 + Float64(y * Float64(Float64(x + -1.0) / Float64(1.0 + y)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -380000000000.0) || ~((y <= 120000000.0))) tmp = x + ((1.0 - x) / y); else tmp = 1.0 + (y * ((x + -1.0) / (1.0 + y))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -380000000000.0], N[Not[LessEqual[y, 120000000.0]], $MachinePrecision]], N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(N[(x + -1.0), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -380000000000 \lor \neg \left(y \leq 120000000\right):\\
\;\;\;\;x + \frac{1 - x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{x + -1}{1 + y}\\
\end{array}
\end{array}
if y < -3.8e11 or 1.2e8 < y Initial program 30.4%
sub-neg30.4%
distribute-neg-frac30.4%
neg-mul-130.4%
associate-*l/30.2%
metadata-eval30.2%
associate-*l/30.2%
associate-/r/30.2%
metadata-eval30.2%
distribute-neg-frac30.2%
cancel-sign-sub-inv30.2%
associate-/r/30.3%
associate-/r*30.3%
neg-mul-130.3%
associate-/r/30.2%
distribute-rgt-neg-in30.2%
associate-/r/30.3%
distribute-neg-frac30.3%
metadata-eval30.3%
associate-/r/30.2%
Simplified55.7%
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%
if -3.8e11 < y < 1.2e8Initial program 99.6%
sub-neg99.6%
distribute-neg-frac99.6%
neg-mul-199.6%
associate-*l/99.6%
metadata-eval99.6%
associate-*l/99.6%
associate-/r/99.6%
metadata-eval99.6%
distribute-neg-frac99.6%
cancel-sign-sub-inv99.6%
associate-/r/99.6%
associate-/r*99.6%
neg-mul-199.6%
associate-/r/99.6%
distribute-rgt-neg-in99.6%
associate-/r/99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
associate-/r/99.6%
Simplified99.7%
Final simplification99.8%
(FPCore (x y)
:precision binary64
(if (<= y -5.2e+40)
x
(if (<= y -1.0)
(/ 1.0 y)
(if (<= y 1.02e-9) (+ 1.0 (* x y)) (* x (/ y (+ 1.0 y)))))))
double code(double x, double y) {
double tmp;
if (y <= -5.2e+40) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= 1.02e-9) {
tmp = 1.0 + (x * y);
} else {
tmp = x * (y / (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 <= (-5.2d+40)) then
tmp = x
else if (y <= (-1.0d0)) then
tmp = 1.0d0 / y
else if (y <= 1.02d-9) then
tmp = 1.0d0 + (x * y)
else
tmp = x * (y / (1.0d0 + y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -5.2e+40) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= 1.02e-9) {
tmp = 1.0 + (x * y);
} else {
tmp = x * (y / (1.0 + y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5.2e+40: tmp = x elif y <= -1.0: tmp = 1.0 / y elif y <= 1.02e-9: tmp = 1.0 + (x * y) else: tmp = x * (y / (1.0 + y)) return tmp
function code(x, y) tmp = 0.0 if (y <= -5.2e+40) tmp = x; elseif (y <= -1.0) tmp = Float64(1.0 / y); elseif (y <= 1.02e-9) tmp = Float64(1.0 + Float64(x * y)); else tmp = Float64(x * Float64(y / Float64(1.0 + y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5.2e+40) tmp = x; elseif (y <= -1.0) tmp = 1.0 / y; elseif (y <= 1.02e-9) tmp = 1.0 + (x * y); else tmp = x * (y / (1.0 + y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5.2e+40], x, If[LessEqual[y, -1.0], N[(1.0 / y), $MachinePrecision], If[LessEqual[y, 1.02e-9], N[(1.0 + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{+40}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{elif}\;y \leq 1.02 \cdot 10^{-9}:\\
\;\;\;\;1 + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{1 + y}\\
\end{array}
\end{array}
if y < -5.2000000000000001e40Initial program 24.8%
sub-neg24.8%
distribute-neg-frac24.8%
neg-mul-124.8%
associate-*l/24.7%
metadata-eval24.7%
associate-*l/24.7%
associate-/r/24.7%
metadata-eval24.7%
distribute-neg-frac24.7%
cancel-sign-sub-inv24.7%
associate-/r/24.7%
associate-/r*24.7%
neg-mul-124.7%
associate-/r/24.7%
distribute-rgt-neg-in24.7%
associate-/r/24.7%
distribute-neg-frac24.7%
metadata-eval24.7%
associate-/r/24.7%
Simplified55.3%
Taylor expanded in y around inf 85.3%
if -5.2000000000000001e40 < y < -1Initial program 20.9%
sub-neg20.9%
distribute-neg-frac20.9%
neg-mul-120.9%
associate-*l/20.7%
metadata-eval20.7%
associate-*l/20.7%
associate-/r/20.7%
metadata-eval20.7%
distribute-neg-frac20.7%
cancel-sign-sub-inv20.7%
associate-/r/20.8%
associate-/r*20.8%
neg-mul-120.8%
associate-/r/20.7%
distribute-rgt-neg-in20.7%
associate-/r/20.8%
distribute-neg-frac20.8%
metadata-eval20.8%
associate-/r/20.7%
Simplified20.7%
Taylor expanded in y around inf 94.8%
+-commutative94.8%
associate--l+94.8%
div-sub94.8%
sub-neg94.8%
+-commutative94.8%
metadata-eval94.8%
distribute-neg-in94.8%
distribute-neg-frac94.8%
metadata-eval94.8%
sub-neg94.8%
unsub-neg94.8%
sub-neg94.8%
metadata-eval94.8%
Simplified94.8%
Taylor expanded in x around 0 80.1%
if -1 < y < 1.01999999999999999e-9Initial 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 x around inf 99.7%
neg-mul-199.7%
distribute-neg-frac99.7%
Simplified99.7%
Taylor expanded in y around 0 99.6%
associate-*r*99.6%
neg-mul-199.6%
Simplified99.6%
if 1.01999999999999999e-9 < y Initial program 42.1%
sub-neg42.1%
distribute-neg-frac42.1%
neg-mul-142.1%
associate-*l/42.0%
metadata-eval42.0%
associate-*l/42.0%
associate-/r/42.0%
metadata-eval42.0%
distribute-neg-frac42.0%
cancel-sign-sub-inv42.0%
associate-/r/41.9%
associate-/r*41.9%
neg-mul-141.9%
associate-/r/42.0%
distribute-rgt-neg-in42.0%
associate-/r/41.9%
distribute-neg-frac41.9%
metadata-eval41.9%
associate-/r/42.0%
Simplified64.4%
Taylor expanded in x around inf 59.0%
*-commutative59.0%
associate-*r/81.3%
*-commutative81.3%
Simplified81.3%
Final simplification91.8%
(FPCore (x y)
:precision binary64
(if (<= y -1.15e+38)
x
(if (<= y -1.0)
(/ 1.0 y)
(if (<= y 2.6e-7) (+ 1.0 (* y (+ x -1.0))) (* x (/ y (+ 1.0 y)))))))
double code(double x, double y) {
double tmp;
if (y <= -1.15e+38) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= 2.6e-7) {
tmp = 1.0 + (y * (x + -1.0));
} else {
tmp = x * (y / (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.15d+38)) then
tmp = x
else if (y <= (-1.0d0)) then
tmp = 1.0d0 / y
else if (y <= 2.6d-7) then
tmp = 1.0d0 + (y * (x + (-1.0d0)))
else
tmp = x * (y / (1.0d0 + y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.15e+38) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= 2.6e-7) {
tmp = 1.0 + (y * (x + -1.0));
} else {
tmp = x * (y / (1.0 + y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.15e+38: tmp = x elif y <= -1.0: tmp = 1.0 / y elif y <= 2.6e-7: tmp = 1.0 + (y * (x + -1.0)) else: tmp = x * (y / (1.0 + y)) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.15e+38) tmp = x; elseif (y <= -1.0) tmp = Float64(1.0 / y); elseif (y <= 2.6e-7) tmp = Float64(1.0 + Float64(y * Float64(x + -1.0))); else tmp = Float64(x * Float64(y / Float64(1.0 + y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.15e+38) tmp = x; elseif (y <= -1.0) tmp = 1.0 / y; elseif (y <= 2.6e-7) tmp = 1.0 + (y * (x + -1.0)); else tmp = x * (y / (1.0 + y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.15e+38], x, If[LessEqual[y, -1.0], N[(1.0 / y), $MachinePrecision], If[LessEqual[y, 2.6e-7], N[(1.0 + N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+38}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{-7}:\\
\;\;\;\;1 + y \cdot \left(x + -1\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{1 + y}\\
\end{array}
\end{array}
if y < -1.1500000000000001e38Initial program 24.8%
sub-neg24.8%
distribute-neg-frac24.8%
neg-mul-124.8%
associate-*l/24.7%
metadata-eval24.7%
associate-*l/24.7%
associate-/r/24.7%
metadata-eval24.7%
distribute-neg-frac24.7%
cancel-sign-sub-inv24.7%
associate-/r/24.7%
associate-/r*24.7%
neg-mul-124.7%
associate-/r/24.7%
distribute-rgt-neg-in24.7%
associate-/r/24.7%
distribute-neg-frac24.7%
metadata-eval24.7%
associate-/r/24.7%
Simplified55.3%
Taylor expanded in y around inf 85.3%
if -1.1500000000000001e38 < y < -1Initial program 20.9%
sub-neg20.9%
distribute-neg-frac20.9%
neg-mul-120.9%
associate-*l/20.7%
metadata-eval20.7%
associate-*l/20.7%
associate-/r/20.7%
metadata-eval20.7%
distribute-neg-frac20.7%
cancel-sign-sub-inv20.7%
associate-/r/20.8%
associate-/r*20.8%
neg-mul-120.8%
associate-/r/20.7%
distribute-rgt-neg-in20.7%
associate-/r/20.8%
distribute-neg-frac20.8%
metadata-eval20.8%
associate-/r/20.7%
Simplified20.7%
Taylor expanded in y around inf 94.8%
+-commutative94.8%
associate--l+94.8%
div-sub94.8%
sub-neg94.8%
+-commutative94.8%
metadata-eval94.8%
distribute-neg-in94.8%
distribute-neg-frac94.8%
metadata-eval94.8%
sub-neg94.8%
unsub-neg94.8%
sub-neg94.8%
metadata-eval94.8%
Simplified94.8%
Taylor expanded in x around 0 80.1%
if -1 < y < 2.59999999999999999e-7Initial 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 99.9%
if 2.59999999999999999e-7 < y Initial program 42.1%
sub-neg42.1%
distribute-neg-frac42.1%
neg-mul-142.1%
associate-*l/42.0%
metadata-eval42.0%
associate-*l/42.0%
associate-/r/42.0%
metadata-eval42.0%
distribute-neg-frac42.0%
cancel-sign-sub-inv42.0%
associate-/r/41.9%
associate-/r*41.9%
neg-mul-141.9%
associate-/r/42.0%
distribute-rgt-neg-in42.0%
associate-/r/41.9%
distribute-neg-frac41.9%
metadata-eval41.9%
associate-/r/42.0%
Simplified64.4%
Taylor expanded in x around inf 59.0%
*-commutative59.0%
associate-*r/81.3%
*-commutative81.3%
Simplified81.3%
Final simplification92.0%
(FPCore (x y) :precision binary64 (if (or (<= y -510000.0) (not (<= y 3500.0))) (+ x (/ (- 1.0 x) y)) (- 1.0 (/ x (/ (- -1.0 y) y)))))
double code(double x, double y) {
double tmp;
if ((y <= -510000.0) || !(y <= 3500.0)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 - (x / ((-1.0 - y) / y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-510000.0d0)) .or. (.not. (y <= 3500.0d0))) then
tmp = x + ((1.0d0 - x) / y)
else
tmp = 1.0d0 - (x / (((-1.0d0) - y) / y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -510000.0) || !(y <= 3500.0)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 - (x / ((-1.0 - y) / y));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -510000.0) or not (y <= 3500.0): tmp = x + ((1.0 - x) / y) else: tmp = 1.0 - (x / ((-1.0 - y) / y)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -510000.0) || !(y <= 3500.0)) tmp = Float64(x + Float64(Float64(1.0 - x) / y)); else tmp = Float64(1.0 - Float64(x / Float64(Float64(-1.0 - y) / y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -510000.0) || ~((y <= 3500.0))) tmp = x + ((1.0 - x) / y); else tmp = 1.0 - (x / ((-1.0 - y) / y)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -510000.0], N[Not[LessEqual[y, 3500.0]], $MachinePrecision]], N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(x / N[(N[(-1.0 - y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -510000 \lor \neg \left(y \leq 3500\right):\\
\;\;\;\;x + \frac{1 - x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{x}{\frac{-1 - y}{y}}\\
\end{array}
\end{array}
if y < -5.1e5 or 3500 < y Initial program 31.7%
sub-neg31.7%
distribute-neg-frac31.7%
neg-mul-131.7%
associate-*l/31.5%
metadata-eval31.5%
associate-*l/31.5%
associate-/r/31.5%
metadata-eval31.5%
distribute-neg-frac31.5%
cancel-sign-sub-inv31.5%
associate-/r/31.5%
associate-/r*31.5%
neg-mul-131.5%
associate-/r/31.5%
distribute-rgt-neg-in31.5%
associate-/r/31.5%
distribute-neg-frac31.5%
metadata-eval31.5%
associate-/r/31.5%
Simplified56.4%
Taylor expanded in y around inf 99.1%
+-commutative99.1%
associate--l+99.1%
div-sub99.1%
sub-neg99.1%
+-commutative99.1%
metadata-eval99.1%
distribute-neg-in99.1%
distribute-neg-frac99.1%
metadata-eval99.1%
sub-neg99.1%
unsub-neg99.1%
sub-neg99.1%
metadata-eval99.1%
Simplified99.1%
if -5.1e5 < y < 3500Initial 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 x around inf 99.7%
neg-mul-199.7%
distribute-neg-frac99.7%
Simplified99.7%
frac-2neg99.7%
remove-double-neg99.7%
associate-*l/99.7%
distribute-neg-in99.7%
metadata-eval99.7%
Applied egg-rr99.7%
associate-/l*99.6%
unsub-neg99.6%
Simplified99.6%
Final simplification99.4%
(FPCore (x y) :precision binary64 (if (or (<= y -18000.0) (not (<= y 3500.0))) (+ x (/ (- 1.0 x) y)) (+ 1.0 (* y (/ x (+ 1.0 y))))))
double code(double x, double y) {
double tmp;
if ((y <= -18000.0) || !(y <= 3500.0)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 + (y * (x / (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 <= (-18000.0d0)) .or. (.not. (y <= 3500.0d0))) then
tmp = x + ((1.0d0 - x) / y)
else
tmp = 1.0d0 + (y * (x / (1.0d0 + y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -18000.0) || !(y <= 3500.0)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = 1.0 + (y * (x / (1.0 + y)));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -18000.0) or not (y <= 3500.0): tmp = x + ((1.0 - x) / y) else: tmp = 1.0 + (y * (x / (1.0 + y))) return tmp
function code(x, y) tmp = 0.0 if ((y <= -18000.0) || !(y <= 3500.0)) tmp = Float64(x + Float64(Float64(1.0 - x) / y)); else tmp = Float64(1.0 + Float64(y * Float64(x / Float64(1.0 + y)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -18000.0) || ~((y <= 3500.0))) tmp = x + ((1.0 - x) / y); else tmp = 1.0 + (y * (x / (1.0 + y))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -18000.0], N[Not[LessEqual[y, 3500.0]], $MachinePrecision]], N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(x / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -18000 \lor \neg \left(y \leq 3500\right):\\
\;\;\;\;x + \frac{1 - x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{x}{1 + y}\\
\end{array}
\end{array}
if y < -18000 or 3500 < y Initial program 31.7%
sub-neg31.7%
distribute-neg-frac31.7%
neg-mul-131.7%
associate-*l/31.5%
metadata-eval31.5%
associate-*l/31.5%
associate-/r/31.5%
metadata-eval31.5%
distribute-neg-frac31.5%
cancel-sign-sub-inv31.5%
associate-/r/31.5%
associate-/r*31.5%
neg-mul-131.5%
associate-/r/31.5%
distribute-rgt-neg-in31.5%
associate-/r/31.5%
distribute-neg-frac31.5%
metadata-eval31.5%
associate-/r/31.5%
Simplified56.4%
Taylor expanded in y around inf 99.1%
+-commutative99.1%
associate--l+99.1%
div-sub99.1%
sub-neg99.1%
+-commutative99.1%
metadata-eval99.1%
distribute-neg-in99.1%
distribute-neg-frac99.1%
metadata-eval99.1%
sub-neg99.1%
unsub-neg99.1%
sub-neg99.1%
metadata-eval99.1%
Simplified99.1%
if -18000 < y < 3500Initial 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 x around inf 99.7%
neg-mul-199.7%
distribute-neg-frac99.7%
Simplified99.7%
Final simplification99.4%
(FPCore (x y) :precision binary64 (if (<= y -1.15e+39) x (if (<= y -1.0) (/ 1.0 y) (if (<= y 3600.0) (+ 1.0 (* x y)) x))))
double code(double x, double y) {
double tmp;
if (y <= -1.15e+39) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= 3600.0) {
tmp = 1.0 + (x * 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.15d+39)) then
tmp = x
else if (y <= (-1.0d0)) then
tmp = 1.0d0 / y
else if (y <= 3600.0d0) then
tmp = 1.0d0 + (x * y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.15e+39) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= 3600.0) {
tmp = 1.0 + (x * y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.15e+39: tmp = x elif y <= -1.0: tmp = 1.0 / y elif y <= 3600.0: tmp = 1.0 + (x * y) else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.15e+39) tmp = x; elseif (y <= -1.0) tmp = Float64(1.0 / y); elseif (y <= 3600.0) tmp = Float64(1.0 + Float64(x * y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.15e+39) tmp = x; elseif (y <= -1.0) tmp = 1.0 / y; elseif (y <= 3600.0) tmp = 1.0 + (x * y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.15e+39], x, If[LessEqual[y, -1.0], N[(1.0 / y), $MachinePrecision], If[LessEqual[y, 3600.0], N[(1.0 + N[(x * y), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+39}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{elif}\;y \leq 3600:\\
\;\;\;\;1 + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.15000000000000006e39 or 3600 < y Initial program 32.1%
sub-neg32.1%
distribute-neg-frac32.1%
neg-mul-132.1%
associate-*l/32.0%
metadata-eval32.0%
associate-*l/32.0%
associate-/r/32.0%
metadata-eval32.0%
distribute-neg-frac32.0%
cancel-sign-sub-inv32.0%
associate-/r/32.0%
associate-/r*32.0%
neg-mul-132.0%
associate-/r/32.0%
distribute-rgt-neg-in32.0%
associate-/r/32.0%
distribute-neg-frac32.0%
metadata-eval32.0%
associate-/r/32.0%
Simplified59.0%
Taylor expanded in y around inf 84.0%
if -1.15000000000000006e39 < y < -1Initial program 20.9%
sub-neg20.9%
distribute-neg-frac20.9%
neg-mul-120.9%
associate-*l/20.7%
metadata-eval20.7%
associate-*l/20.7%
associate-/r/20.7%
metadata-eval20.7%
distribute-neg-frac20.7%
cancel-sign-sub-inv20.7%
associate-/r/20.8%
associate-/r*20.8%
neg-mul-120.8%
associate-/r/20.7%
distribute-rgt-neg-in20.7%
associate-/r/20.8%
distribute-neg-frac20.8%
metadata-eval20.8%
associate-/r/20.7%
Simplified20.7%
Taylor expanded in y around inf 94.8%
+-commutative94.8%
associate--l+94.8%
div-sub94.8%
sub-neg94.8%
+-commutative94.8%
metadata-eval94.8%
distribute-neg-in94.8%
distribute-neg-frac94.8%
metadata-eval94.8%
sub-neg94.8%
unsub-neg94.8%
sub-neg94.8%
metadata-eval94.8%
Simplified94.8%
Taylor expanded in x around 0 80.1%
if -1 < y < 3600Initial 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.8%
associate-/r*99.8%
neg-mul-199.8%
associate-/r/99.9%
distribute-rgt-neg-in99.9%
associate-/r/99.8%
distribute-neg-frac99.8%
metadata-eval99.8%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around inf 99.1%
neg-mul-199.1%
distribute-neg-frac99.1%
Simplified99.1%
Taylor expanded in y around 0 98.7%
associate-*r*98.7%
neg-mul-198.7%
Simplified98.7%
Final simplification91.7%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (+ x (/ (- 1.0 x) y)) (+ 1.0 (* y (+ x -1.0)))))
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 * (x + -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 <= (-1.0d0)) .or. (.not. (y <= 1.0d0))) then
tmp = x + ((1.0d0 - x) / y)
else
tmp = 1.0d0 + (y * (x + (-1.0d0)))
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 * (x + -1.0));
}
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 * (x + -1.0)) 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(x + -1.0))); 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 * (x + -1.0)); 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[(x + -1.0), $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(x + -1\right)\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 31.7%
sub-neg31.7%
distribute-neg-frac31.7%
neg-mul-131.7%
associate-*l/31.5%
metadata-eval31.5%
associate-*l/31.5%
associate-/r/31.5%
metadata-eval31.5%
distribute-neg-frac31.5%
cancel-sign-sub-inv31.5%
associate-/r/31.5%
associate-/r*31.5%
neg-mul-131.5%
associate-/r/31.5%
distribute-rgt-neg-in31.5%
associate-/r/31.5%
distribute-neg-frac31.5%
metadata-eval31.5%
associate-/r/31.5%
Simplified56.4%
Taylor expanded in y around inf 99.1%
+-commutative99.1%
associate--l+99.1%
div-sub99.1%
sub-neg99.1%
+-commutative99.1%
metadata-eval99.1%
distribute-neg-in99.1%
distribute-neg-frac99.1%
metadata-eval99.1%
sub-neg99.1%
unsub-neg99.1%
sub-neg99.1%
metadata-eval99.1%
Simplified99.1%
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/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 99.6%
Final simplification99.3%
(FPCore (x y) :precision binary64 (if (<= y -1.1e+40) x (if (<= y -1.0) (/ 1.0 y) (if (<= y 2.9e-7) (- 1.0 y) x))))
double code(double x, double y) {
double tmp;
if (y <= -1.1e+40) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= 2.9e-7) {
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.1d+40)) then
tmp = x
else if (y <= (-1.0d0)) then
tmp = 1.0d0 / y
else if (y <= 2.9d-7) 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.1e+40) {
tmp = x;
} else if (y <= -1.0) {
tmp = 1.0 / y;
} else if (y <= 2.9e-7) {
tmp = 1.0 - y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.1e+40: tmp = x elif y <= -1.0: tmp = 1.0 / y elif y <= 2.9e-7: tmp = 1.0 - y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.1e+40) tmp = x; elseif (y <= -1.0) tmp = Float64(1.0 / y); elseif (y <= 2.9e-7) tmp = Float64(1.0 - y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.1e+40) tmp = x; elseif (y <= -1.0) tmp = 1.0 / y; elseif (y <= 2.9e-7) tmp = 1.0 - y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.1e+40], x, If[LessEqual[y, -1.0], N[(1.0 / y), $MachinePrecision], If[LessEqual[y, 2.9e-7], N[(1.0 - y), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{+40}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{-7}:\\
\;\;\;\;1 - y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.0999999999999999e40 or 2.8999999999999998e-7 < y Initial program 33.1%
sub-neg33.1%
distribute-neg-frac33.1%
neg-mul-133.1%
associate-*l/33.0%
metadata-eval33.0%
associate-*l/33.0%
associate-/r/33.0%
metadata-eval33.0%
distribute-neg-frac33.0%
cancel-sign-sub-inv33.0%
associate-/r/33.0%
associate-/r*33.0%
neg-mul-133.0%
associate-/r/33.0%
distribute-rgt-neg-in33.0%
associate-/r/33.0%
distribute-neg-frac33.0%
metadata-eval33.0%
associate-/r/33.0%
Simplified59.7%
Taylor expanded in y around inf 82.6%
if -1.0999999999999999e40 < y < -1Initial program 20.9%
sub-neg20.9%
distribute-neg-frac20.9%
neg-mul-120.9%
associate-*l/20.7%
metadata-eval20.7%
associate-*l/20.7%
associate-/r/20.7%
metadata-eval20.7%
distribute-neg-frac20.7%
cancel-sign-sub-inv20.7%
associate-/r/20.8%
associate-/r*20.8%
neg-mul-120.8%
associate-/r/20.7%
distribute-rgt-neg-in20.7%
associate-/r/20.8%
distribute-neg-frac20.8%
metadata-eval20.8%
associate-/r/20.7%
Simplified20.7%
Taylor expanded in y around inf 94.8%
+-commutative94.8%
associate--l+94.8%
div-sub94.8%
sub-neg94.8%
+-commutative94.8%
metadata-eval94.8%
distribute-neg-in94.8%
distribute-neg-frac94.8%
metadata-eval94.8%
sub-neg94.8%
unsub-neg94.8%
sub-neg94.8%
metadata-eval94.8%
Simplified94.8%
Taylor expanded in x around 0 80.1%
if -1 < y < 2.8999999999999998e-7Initial 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 99.9%
Taylor expanded in x around 0 77.4%
Final simplification79.8%
(FPCore (x y) :precision binary64 (if (<= y -9500000.0) x (if (<= y -3.45e-47) (* x y) (if (<= y 3600.0) 1.0 x))))
double code(double x, double y) {
double tmp;
if (y <= -9500000.0) {
tmp = x;
} else if (y <= -3.45e-47) {
tmp = x * y;
} else if (y <= 3600.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 <= (-9500000.0d0)) then
tmp = x
else if (y <= (-3.45d-47)) then
tmp = x * y
else if (y <= 3600.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 <= -9500000.0) {
tmp = x;
} else if (y <= -3.45e-47) {
tmp = x * y;
} else if (y <= 3600.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -9500000.0: tmp = x elif y <= -3.45e-47: tmp = x * y elif y <= 3600.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -9500000.0) tmp = x; elseif (y <= -3.45e-47) tmp = Float64(x * y); elseif (y <= 3600.0) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -9500000.0) tmp = x; elseif (y <= -3.45e-47) tmp = x * y; elseif (y <= 3600.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -9500000.0], x, If[LessEqual[y, -3.45e-47], N[(x * y), $MachinePrecision], If[LessEqual[y, 3600.0], 1.0, x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9500000:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -3.45 \cdot 10^{-47}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;y \leq 3600:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -9.5e6 or 3600 < y Initial program 31.0%
sub-neg31.0%
distribute-neg-frac31.0%
neg-mul-131.0%
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.8%
associate-/r*30.8%
neg-mul-130.8%
associate-/r/30.8%
distribute-rgt-neg-in30.8%
associate-/r/30.8%
distribute-neg-frac30.8%
metadata-eval30.8%
associate-/r/30.8%
Simplified56.1%
Taylor expanded in y around inf 79.4%
if -9.5e6 < y < -3.44999999999999997e-47Initial program 96.1%
sub-neg96.1%
distribute-neg-frac96.1%
neg-mul-196.1%
associate-*l/96.1%
metadata-eval96.1%
associate-*l/96.1%
associate-/r/96.1%
metadata-eval96.1%
distribute-neg-frac96.1%
cancel-sign-sub-inv96.1%
associate-/r/96.0%
associate-/r*96.0%
neg-mul-196.0%
associate-/r/96.1%
distribute-rgt-neg-in96.1%
associate-/r/96.0%
distribute-neg-frac96.0%
metadata-eval96.0%
associate-/r/96.1%
Simplified95.9%
Taylor expanded in x around inf 67.5%
*-commutative67.5%
associate-*r/67.5%
*-commutative67.5%
Simplified67.5%
Taylor expanded in y around 0 67.7%
if -3.44999999999999997e-47 < y < 3600Initial 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.8%
associate-/r*99.8%
neg-mul-199.8%
associate-/r/99.9%
distribute-rgt-neg-in99.9%
associate-/r/99.8%
distribute-neg-frac99.8%
metadata-eval99.8%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in y around 0 79.3%
Final simplification78.9%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 2.9e-7) (- 1.0 y) x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 2.9e-7) {
tmp = 1.0 - y;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.0d0)) then
tmp = x
else if (y <= 2.9d-7) then
tmp = 1.0d0 - y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 2.9e-7) {
tmp = 1.0 - y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 2.9e-7: tmp = 1.0 - y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 2.9e-7) tmp = Float64(1.0 - y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = x; elseif (y <= 2.9e-7) tmp = 1.0 - y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 2.9e-7], N[(1.0 - y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{-7}:\\
\;\;\;\;1 - y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 2.8999999999999998e-7 < y Initial program 32.2%
sub-neg32.2%
distribute-neg-frac32.2%
neg-mul-132.2%
associate-*l/32.1%
metadata-eval32.1%
associate-*l/32.1%
associate-/r/32.1%
metadata-eval32.1%
distribute-neg-frac32.1%
cancel-sign-sub-inv32.1%
associate-/r/32.1%
associate-/r*32.1%
neg-mul-132.1%
associate-/r/32.1%
distribute-rgt-neg-in32.1%
associate-/r/32.1%
distribute-neg-frac32.1%
metadata-eval32.1%
associate-/r/32.1%
Simplified56.8%
Taylor expanded in y around inf 77.6%
if -1 < y < 2.8999999999999998e-7Initial 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 99.9%
Taylor expanded in x around 0 77.4%
Final simplification77.5%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 3600.0) 1.0 x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 3600.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 <= 3600.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 <= 3600.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 3600.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 3600.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 <= 3600.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 3600.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 3600:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 3600 < y Initial program 31.2%
sub-neg31.2%
distribute-neg-frac31.2%
neg-mul-131.2%
associate-*l/31.1%
metadata-eval31.1%
associate-*l/31.1%
associate-/r/31.1%
metadata-eval31.1%
distribute-neg-frac31.1%
cancel-sign-sub-inv31.1%
associate-/r/31.1%
associate-/r*31.1%
neg-mul-131.1%
associate-/r/31.1%
distribute-rgt-neg-in31.1%
associate-/r/31.1%
distribute-neg-frac31.1%
metadata-eval31.1%
associate-/r/31.1%
Simplified56.1%
Taylor expanded in y around inf 78.7%
if -1 < y < 3600Initial 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.8%
associate-/r*99.8%
neg-mul-199.8%
associate-/r/99.9%
distribute-rgt-neg-in99.9%
associate-/r/99.8%
distribute-neg-frac99.8%
metadata-eval99.8%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in y around 0 76.1%
Final simplification77.3%
(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 68.0%
sub-neg68.0%
distribute-neg-frac68.0%
neg-mul-168.0%
associate-*l/67.9%
metadata-eval67.9%
associate-*l/67.9%
associate-/r/67.9%
metadata-eval67.9%
distribute-neg-frac67.9%
cancel-sign-sub-inv67.9%
associate-/r/67.9%
associate-/r*67.9%
neg-mul-167.9%
associate-/r/67.9%
distribute-rgt-neg-in67.9%
associate-/r/67.9%
distribute-neg-frac67.9%
metadata-eval67.9%
associate-/r/67.9%
Simplified79.6%
Taylor expanded in y around 0 42.4%
Final simplification42.4%
(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 2023199
(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))))