
(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 (/ (* y (- 1.0 x)) (+ 1.0 y))) (t_1 (/ y (+ 1.0 y))))
(if (<= t_0 5e-13)
(+ 1.0 (* t_1 (+ x -1.0)))
(if (<= t_0 1.002)
(- x (/ (- (+ x -1.0) (/ (+ (+ x -1.0) (/ (- 1.0 x) y)) y)) y))
(* x (+ (/ y (* x (- -1.0 y))) (+ t_1 (/ 1.0 x))))))))
double code(double x, double y) {
double t_0 = (y * (1.0 - x)) / (1.0 + y);
double t_1 = y / (1.0 + y);
double tmp;
if (t_0 <= 5e-13) {
tmp = 1.0 + (t_1 * (x + -1.0));
} else if (t_0 <= 1.002) {
tmp = x - (((x + -1.0) - (((x + -1.0) + ((1.0 - x) / y)) / y)) / y);
} else {
tmp = x * ((y / (x * (-1.0 - y))) + (t_1 + (1.0 / x)));
}
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 = (y * (1.0d0 - x)) / (1.0d0 + y)
t_1 = y / (1.0d0 + y)
if (t_0 <= 5d-13) then
tmp = 1.0d0 + (t_1 * (x + (-1.0d0)))
else if (t_0 <= 1.002d0) then
tmp = x - (((x + (-1.0d0)) - (((x + (-1.0d0)) + ((1.0d0 - x) / y)) / y)) / y)
else
tmp = x * ((y / (x * ((-1.0d0) - y))) + (t_1 + (1.0d0 / x)))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y * (1.0 - x)) / (1.0 + y);
double t_1 = y / (1.0 + y);
double tmp;
if (t_0 <= 5e-13) {
tmp = 1.0 + (t_1 * (x + -1.0));
} else if (t_0 <= 1.002) {
tmp = x - (((x + -1.0) - (((x + -1.0) + ((1.0 - x) / y)) / y)) / y);
} else {
tmp = x * ((y / (x * (-1.0 - y))) + (t_1 + (1.0 / x)));
}
return tmp;
}
def code(x, y): t_0 = (y * (1.0 - x)) / (1.0 + y) t_1 = y / (1.0 + y) tmp = 0 if t_0 <= 5e-13: tmp = 1.0 + (t_1 * (x + -1.0)) elif t_0 <= 1.002: tmp = x - (((x + -1.0) - (((x + -1.0) + ((1.0 - x) / y)) / y)) / y) else: tmp = x * ((y / (x * (-1.0 - y))) + (t_1 + (1.0 / x))) return tmp
function code(x, y) t_0 = Float64(Float64(y * Float64(1.0 - x)) / Float64(1.0 + y)) t_1 = Float64(y / Float64(1.0 + y)) tmp = 0.0 if (t_0 <= 5e-13) tmp = Float64(1.0 + Float64(t_1 * Float64(x + -1.0))); elseif (t_0 <= 1.002) tmp = Float64(x - Float64(Float64(Float64(x + -1.0) - Float64(Float64(Float64(x + -1.0) + Float64(Float64(1.0 - x) / y)) / y)) / y)); else tmp = Float64(x * Float64(Float64(y / Float64(x * Float64(-1.0 - y))) + Float64(t_1 + Float64(1.0 / x)))); end return tmp end
function tmp_2 = code(x, y) t_0 = (y * (1.0 - x)) / (1.0 + y); t_1 = y / (1.0 + y); tmp = 0.0; if (t_0 <= 5e-13) tmp = 1.0 + (t_1 * (x + -1.0)); elseif (t_0 <= 1.002) tmp = x - (((x + -1.0) - (((x + -1.0) + ((1.0 - x) / y)) / y)) / y); else tmp = x * ((y / (x * (-1.0 - y))) + (t_1 + (1.0 / x))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y * N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e-13], N[(1.0 + N[(t$95$1 * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.002], N[(x - N[(N[(N[(x + -1.0), $MachinePrecision] - N[(N[(N[(x + -1.0), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / N[(x * N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y \cdot \left(1 - x\right)}{1 + y}\\
t_1 := \frac{y}{1 + y}\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{-13}:\\
\;\;\;\;1 + t\_1 \cdot \left(x + -1\right)\\
\mathbf{elif}\;t\_0 \leq 1.002:\\
\;\;\;\;x - \frac{\left(x + -1\right) - \frac{\left(x + -1\right) + \frac{1 - x}{y}}{y}}{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{x \cdot \left(-1 - y\right)} + \left(t\_1 + \frac{1}{x}\right)\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 4.9999999999999999e-13Initial program 86.6%
associate-/l*100.0%
+-commutative100.0%
Simplified100.0%
if 4.9999999999999999e-13 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 1.002Initial program 10.9%
associate-/l*10.9%
+-commutative10.9%
Simplified10.9%
Taylor expanded in y around -inf 99.9%
mul-1-neg99.9%
distribute-lft-out--99.9%
distribute-lft-out--99.9%
sub-neg99.9%
metadata-eval99.9%
sub-neg99.9%
metadata-eval99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
if 1.002 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) Initial program 62.3%
sub-neg62.3%
+-commutative62.3%
associate-/l*99.7%
distribute-rgt-neg-in99.7%
fma-define99.7%
distribute-neg-frac299.7%
+-commutative99.7%
distribute-neg-in99.7%
metadata-eval99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in x around inf 99.8%
mul-1-neg99.8%
distribute-neg-frac299.8%
distribute-rgt-neg-out99.8%
distribute-neg-in99.8%
metadata-eval99.8%
sub-neg99.8%
+-commutative99.8%
+-commutative99.8%
Simplified99.8%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* y (- 1.0 x)) (+ 1.0 y))) (t_1 (/ y (+ 1.0 y))))
(if (<= t_0 5e-13)
(+ 1.0 (* t_1 (+ x -1.0)))
(if (<= t_0 1.002)
(+ x (/ -1.0 (/ y (+ (+ x -1.0) (/ (- 1.0 x) y)))))
(* x (+ (/ y (* x (- -1.0 y))) (+ t_1 (/ 1.0 x))))))))
double code(double x, double y) {
double t_0 = (y * (1.0 - x)) / (1.0 + y);
double t_1 = y / (1.0 + y);
double tmp;
if (t_0 <= 5e-13) {
tmp = 1.0 + (t_1 * (x + -1.0));
} else if (t_0 <= 1.002) {
tmp = x + (-1.0 / (y / ((x + -1.0) + ((1.0 - x) / y))));
} else {
tmp = x * ((y / (x * (-1.0 - y))) + (t_1 + (1.0 / x)));
}
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 = (y * (1.0d0 - x)) / (1.0d0 + y)
t_1 = y / (1.0d0 + y)
if (t_0 <= 5d-13) then
tmp = 1.0d0 + (t_1 * (x + (-1.0d0)))
else if (t_0 <= 1.002d0) then
tmp = x + ((-1.0d0) / (y / ((x + (-1.0d0)) + ((1.0d0 - x) / y))))
else
tmp = x * ((y / (x * ((-1.0d0) - y))) + (t_1 + (1.0d0 / x)))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y * (1.0 - x)) / (1.0 + y);
double t_1 = y / (1.0 + y);
double tmp;
if (t_0 <= 5e-13) {
tmp = 1.0 + (t_1 * (x + -1.0));
} else if (t_0 <= 1.002) {
tmp = x + (-1.0 / (y / ((x + -1.0) + ((1.0 - x) / y))));
} else {
tmp = x * ((y / (x * (-1.0 - y))) + (t_1 + (1.0 / x)));
}
return tmp;
}
def code(x, y): t_0 = (y * (1.0 - x)) / (1.0 + y) t_1 = y / (1.0 + y) tmp = 0 if t_0 <= 5e-13: tmp = 1.0 + (t_1 * (x + -1.0)) elif t_0 <= 1.002: tmp = x + (-1.0 / (y / ((x + -1.0) + ((1.0 - x) / y)))) else: tmp = x * ((y / (x * (-1.0 - y))) + (t_1 + (1.0 / x))) return tmp
function code(x, y) t_0 = Float64(Float64(y * Float64(1.0 - x)) / Float64(1.0 + y)) t_1 = Float64(y / Float64(1.0 + y)) tmp = 0.0 if (t_0 <= 5e-13) tmp = Float64(1.0 + Float64(t_1 * Float64(x + -1.0))); elseif (t_0 <= 1.002) tmp = Float64(x + Float64(-1.0 / Float64(y / Float64(Float64(x + -1.0) + Float64(Float64(1.0 - x) / y))))); else tmp = Float64(x * Float64(Float64(y / Float64(x * Float64(-1.0 - y))) + Float64(t_1 + Float64(1.0 / x)))); end return tmp end
function tmp_2 = code(x, y) t_0 = (y * (1.0 - x)) / (1.0 + y); t_1 = y / (1.0 + y); tmp = 0.0; if (t_0 <= 5e-13) tmp = 1.0 + (t_1 * (x + -1.0)); elseif (t_0 <= 1.002) tmp = x + (-1.0 / (y / ((x + -1.0) + ((1.0 - x) / y)))); else tmp = x * ((y / (x * (-1.0 - y))) + (t_1 + (1.0 / x))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y * N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e-13], N[(1.0 + N[(t$95$1 * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.002], N[(x + N[(-1.0 / N[(y / N[(N[(x + -1.0), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / N[(x * N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y \cdot \left(1 - x\right)}{1 + y}\\
t_1 := \frac{y}{1 + y}\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{-13}:\\
\;\;\;\;1 + t\_1 \cdot \left(x + -1\right)\\
\mathbf{elif}\;t\_0 \leq 1.002:\\
\;\;\;\;x + \frac{-1}{\frac{y}{\left(x + -1\right) + \frac{1 - x}{y}}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{x \cdot \left(-1 - y\right)} + \left(t\_1 + \frac{1}{x}\right)\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 4.9999999999999999e-13Initial program 86.6%
associate-/l*100.0%
+-commutative100.0%
Simplified100.0%
if 4.9999999999999999e-13 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 1.002Initial program 10.9%
associate-/l*10.9%
+-commutative10.9%
Simplified10.9%
Taylor expanded in y around -inf 99.7%
mul-1-neg99.7%
unsub-neg99.7%
Simplified99.7%
clear-num99.7%
inv-pow99.7%
+-commutative99.7%
+-commutative99.7%
Applied egg-rr99.7%
unpow-199.7%
+-commutative99.7%
Simplified99.7%
if 1.002 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) Initial program 62.3%
sub-neg62.3%
+-commutative62.3%
associate-/l*99.7%
distribute-rgt-neg-in99.7%
fma-define99.7%
distribute-neg-frac299.7%
+-commutative99.7%
distribute-neg-in99.7%
metadata-eval99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in x around inf 99.8%
mul-1-neg99.8%
distribute-neg-frac299.8%
distribute-rgt-neg-out99.8%
distribute-neg-in99.8%
metadata-eval99.8%
sub-neg99.8%
+-commutative99.8%
+-commutative99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (or (<= y -145000000.0) (not (<= y 33000000000.0))) (+ x (/ (- (/ -1.0 y) -1.0) y)) (- 1.0 (/ (* y (- 1.0 x)) (+ 1.0 y)))))
double code(double x, double y) {
double tmp;
if ((y <= -145000000.0) || !(y <= 33000000000.0)) {
tmp = x + (((-1.0 / y) - -1.0) / y);
} else {
tmp = 1.0 - ((y * (1.0 - 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 <= (-145000000.0d0)) .or. (.not. (y <= 33000000000.0d0))) then
tmp = x + ((((-1.0d0) / y) - (-1.0d0)) / y)
else
tmp = 1.0d0 - ((y * (1.0d0 - x)) / (1.0d0 + y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -145000000.0) || !(y <= 33000000000.0)) {
tmp = x + (((-1.0 / y) - -1.0) / y);
} else {
tmp = 1.0 - ((y * (1.0 - x)) / (1.0 + y));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -145000000.0) or not (y <= 33000000000.0): tmp = x + (((-1.0 / y) - -1.0) / y) else: tmp = 1.0 - ((y * (1.0 - x)) / (1.0 + y)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -145000000.0) || !(y <= 33000000000.0)) tmp = Float64(x + Float64(Float64(Float64(-1.0 / y) - -1.0) / y)); else tmp = Float64(1.0 - Float64(Float64(y * Float64(1.0 - x)) / Float64(1.0 + y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -145000000.0) || ~((y <= 33000000000.0))) tmp = x + (((-1.0 / y) - -1.0) / y); else tmp = 1.0 - ((y * (1.0 - x)) / (1.0 + y)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -145000000.0], N[Not[LessEqual[y, 33000000000.0]], $MachinePrecision]], N[(x + N[(N[(N[(-1.0 / y), $MachinePrecision] - -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(y * N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -145000000 \lor \neg \left(y \leq 33000000000\right):\\
\;\;\;\;x + \frac{\frac{-1}{y} - -1}{y}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y \cdot \left(1 - x\right)}{1 + y}\\
\end{array}
\end{array}
if y < -1.45e8 or 3.3e10 < y Initial program 28.7%
associate-/l*57.1%
+-commutative57.1%
Simplified57.1%
Taylor expanded in y around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
if -1.45e8 < y < 3.3e10Initial program 99.7%
Final simplification99.8%
(FPCore (x y) :precision binary64 (if (or (<= y -13000000000.0) (not (<= y 32000000000.0))) (+ x (/ (- (/ -1.0 y) -1.0) y)) (+ 1.0 (* (/ y (+ 1.0 y)) (+ x -1.0)))))
double code(double x, double y) {
double tmp;
if ((y <= -13000000000.0) || !(y <= 32000000000.0)) {
tmp = x + (((-1.0 / y) - -1.0) / y);
} else {
tmp = 1.0 + ((y / (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 <= (-13000000000.0d0)) .or. (.not. (y <= 32000000000.0d0))) then
tmp = x + ((((-1.0d0) / y) - (-1.0d0)) / y)
else
tmp = 1.0d0 + ((y / (1.0d0 + y)) * (x + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -13000000000.0) || !(y <= 32000000000.0)) {
tmp = x + (((-1.0 / y) - -1.0) / y);
} else {
tmp = 1.0 + ((y / (1.0 + y)) * (x + -1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -13000000000.0) or not (y <= 32000000000.0): tmp = x + (((-1.0 / y) - -1.0) / y) else: tmp = 1.0 + ((y / (1.0 + y)) * (x + -1.0)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -13000000000.0) || !(y <= 32000000000.0)) tmp = Float64(x + Float64(Float64(Float64(-1.0 / y) - -1.0) / y)); else tmp = Float64(1.0 + Float64(Float64(y / Float64(1.0 + y)) * Float64(x + -1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -13000000000.0) || ~((y <= 32000000000.0))) tmp = x + (((-1.0 / y) - -1.0) / y); else tmp = 1.0 + ((y / (1.0 + y)) * (x + -1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -13000000000.0], N[Not[LessEqual[y, 32000000000.0]], $MachinePrecision]], N[(x + N[(N[(N[(-1.0 / y), $MachinePrecision] - -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(y / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -13000000000 \lor \neg \left(y \leq 32000000000\right):\\
\;\;\;\;x + \frac{\frac{-1}{y} - -1}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y}{1 + y} \cdot \left(x + -1\right)\\
\end{array}
\end{array}
if y < -1.3e10 or 3.2e10 < y Initial program 28.7%
associate-/l*57.1%
+-commutative57.1%
Simplified57.1%
Taylor expanded in y around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
if -1.3e10 < y < 3.2e10Initial program 99.7%
associate-/l*99.7%
+-commutative99.7%
Simplified99.7%
Final simplification99.8%
(FPCore (x y)
:precision binary64
(if (<= y -260000.0)
(+ x (/ -1.0 (/ y (+ (+ x -1.0) (/ (- 1.0 x) y)))))
(if (<= y 32000000000.0)
(- 1.0 (/ (* y (- 1.0 x)) (+ 1.0 y)))
(+ x (/ (- (/ -1.0 y) -1.0) y)))))
double code(double x, double y) {
double tmp;
if (y <= -260000.0) {
tmp = x + (-1.0 / (y / ((x + -1.0) + ((1.0 - x) / y))));
} else if (y <= 32000000000.0) {
tmp = 1.0 - ((y * (1.0 - x)) / (1.0 + y));
} else {
tmp = x + (((-1.0 / 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 <= (-260000.0d0)) then
tmp = x + ((-1.0d0) / (y / ((x + (-1.0d0)) + ((1.0d0 - x) / y))))
else if (y <= 32000000000.0d0) then
tmp = 1.0d0 - ((y * (1.0d0 - x)) / (1.0d0 + y))
else
tmp = x + ((((-1.0d0) / y) - (-1.0d0)) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -260000.0) {
tmp = x + (-1.0 / (y / ((x + -1.0) + ((1.0 - x) / y))));
} else if (y <= 32000000000.0) {
tmp = 1.0 - ((y * (1.0 - x)) / (1.0 + y));
} else {
tmp = x + (((-1.0 / y) - -1.0) / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -260000.0: tmp = x + (-1.0 / (y / ((x + -1.0) + ((1.0 - x) / y)))) elif y <= 32000000000.0: tmp = 1.0 - ((y * (1.0 - x)) / (1.0 + y)) else: tmp = x + (((-1.0 / y) - -1.0) / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -260000.0) tmp = Float64(x + Float64(-1.0 / Float64(y / Float64(Float64(x + -1.0) + Float64(Float64(1.0 - x) / y))))); elseif (y <= 32000000000.0) tmp = Float64(1.0 - Float64(Float64(y * Float64(1.0 - x)) / Float64(1.0 + y))); else tmp = Float64(x + Float64(Float64(Float64(-1.0 / y) - -1.0) / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -260000.0) tmp = x + (-1.0 / (y / ((x + -1.0) + ((1.0 - x) / y)))); elseif (y <= 32000000000.0) tmp = 1.0 - ((y * (1.0 - x)) / (1.0 + y)); else tmp = x + (((-1.0 / y) - -1.0) / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -260000.0], N[(x + N[(-1.0 / N[(y / N[(N[(x + -1.0), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 32000000000.0], N[(1.0 - N[(N[(y * N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(-1.0 / y), $MachinePrecision] - -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -260000:\\
\;\;\;\;x + \frac{-1}{\frac{y}{\left(x + -1\right) + \frac{1 - x}{y}}}\\
\mathbf{elif}\;y \leq 32000000000:\\
\;\;\;\;1 - \frac{y \cdot \left(1 - x\right)}{1 + y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{-1}{y} - -1}{y}\\
\end{array}
\end{array}
if y < -2.6e5Initial program 28.7%
associate-/l*64.0%
+-commutative64.0%
Simplified64.0%
Taylor expanded in y around -inf 99.7%
mul-1-neg99.7%
unsub-neg99.7%
Simplified99.7%
clear-num99.7%
inv-pow99.7%
+-commutative99.7%
+-commutative99.7%
Applied egg-rr99.7%
unpow-199.7%
+-commutative99.7%
Simplified99.7%
if -2.6e5 < y < 3.2e10Initial program 99.9%
if 3.2e10 < y Initial program 29.3%
associate-/l*50.3%
+-commutative50.3%
Simplified50.3%
Taylor expanded in y around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(if (<= y -235000.0)
(- x (/ (+ (+ x -1.0) (/ (- 1.0 x) y)) y))
(if (<= y 34000000000.0)
(- 1.0 (/ (* y (- 1.0 x)) (+ 1.0 y)))
(+ x (/ (- (/ -1.0 y) -1.0) y)))))
double code(double x, double y) {
double tmp;
if (y <= -235000.0) {
tmp = x - (((x + -1.0) + ((1.0 - x) / y)) / y);
} else if (y <= 34000000000.0) {
tmp = 1.0 - ((y * (1.0 - x)) / (1.0 + y));
} else {
tmp = x + (((-1.0 / 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 <= (-235000.0d0)) then
tmp = x - (((x + (-1.0d0)) + ((1.0d0 - x) / y)) / y)
else if (y <= 34000000000.0d0) then
tmp = 1.0d0 - ((y * (1.0d0 - x)) / (1.0d0 + y))
else
tmp = x + ((((-1.0d0) / y) - (-1.0d0)) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -235000.0) {
tmp = x - (((x + -1.0) + ((1.0 - x) / y)) / y);
} else if (y <= 34000000000.0) {
tmp = 1.0 - ((y * (1.0 - x)) / (1.0 + y));
} else {
tmp = x + (((-1.0 / y) - -1.0) / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -235000.0: tmp = x - (((x + -1.0) + ((1.0 - x) / y)) / y) elif y <= 34000000000.0: tmp = 1.0 - ((y * (1.0 - x)) / (1.0 + y)) else: tmp = x + (((-1.0 / y) - -1.0) / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -235000.0) tmp = Float64(x - Float64(Float64(Float64(x + -1.0) + Float64(Float64(1.0 - x) / y)) / y)); elseif (y <= 34000000000.0) tmp = Float64(1.0 - Float64(Float64(y * Float64(1.0 - x)) / Float64(1.0 + y))); else tmp = Float64(x + Float64(Float64(Float64(-1.0 / y) - -1.0) / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -235000.0) tmp = x - (((x + -1.0) + ((1.0 - x) / y)) / y); elseif (y <= 34000000000.0) tmp = 1.0 - ((y * (1.0 - x)) / (1.0 + y)); else tmp = x + (((-1.0 / y) - -1.0) / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -235000.0], N[(x - N[(N[(N[(x + -1.0), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 34000000000.0], N[(1.0 - N[(N[(y * N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(-1.0 / y), $MachinePrecision] - -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -235000:\\
\;\;\;\;x - \frac{\left(x + -1\right) + \frac{1 - x}{y}}{y}\\
\mathbf{elif}\;y \leq 34000000000:\\
\;\;\;\;1 - \frac{y \cdot \left(1 - x\right)}{1 + y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{-1}{y} - -1}{y}\\
\end{array}
\end{array}
if y < -235000Initial program 28.7%
associate-/l*64.0%
+-commutative64.0%
Simplified64.0%
Taylor expanded in y around -inf 99.7%
mul-1-neg99.7%
unsub-neg99.7%
Simplified99.7%
if -235000 < y < 3.4e10Initial program 99.9%
if 3.4e10 < y Initial program 29.3%
associate-/l*50.3%
+-commutative50.3%
Simplified50.3%
Taylor expanded in y around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(if (<= y -950000.0)
(+ x (/ (+ (- 1.0 x) (/ -1.0 y)) y))
(if (<= y 32000000000.0)
(- 1.0 (/ (* y (- 1.0 x)) (+ 1.0 y)))
(+ x (/ (- (/ -1.0 y) -1.0) y)))))
double code(double x, double y) {
double tmp;
if (y <= -950000.0) {
tmp = x + (((1.0 - x) + (-1.0 / y)) / y);
} else if (y <= 32000000000.0) {
tmp = 1.0 - ((y * (1.0 - x)) / (1.0 + y));
} else {
tmp = x + (((-1.0 / 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 <= (-950000.0d0)) then
tmp = x + (((1.0d0 - x) + ((-1.0d0) / y)) / y)
else if (y <= 32000000000.0d0) then
tmp = 1.0d0 - ((y * (1.0d0 - x)) / (1.0d0 + y))
else
tmp = x + ((((-1.0d0) / y) - (-1.0d0)) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -950000.0) {
tmp = x + (((1.0 - x) + (-1.0 / y)) / y);
} else if (y <= 32000000000.0) {
tmp = 1.0 - ((y * (1.0 - x)) / (1.0 + y));
} else {
tmp = x + (((-1.0 / y) - -1.0) / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -950000.0: tmp = x + (((1.0 - x) + (-1.0 / y)) / y) elif y <= 32000000000.0: tmp = 1.0 - ((y * (1.0 - x)) / (1.0 + y)) else: tmp = x + (((-1.0 / y) - -1.0) / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -950000.0) tmp = Float64(x + Float64(Float64(Float64(1.0 - x) + Float64(-1.0 / y)) / y)); elseif (y <= 32000000000.0) tmp = Float64(1.0 - Float64(Float64(y * Float64(1.0 - x)) / Float64(1.0 + y))); else tmp = Float64(x + Float64(Float64(Float64(-1.0 / y) - -1.0) / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -950000.0) tmp = x + (((1.0 - x) + (-1.0 / y)) / y); elseif (y <= 32000000000.0) tmp = 1.0 - ((y * (1.0 - x)) / (1.0 + y)); else tmp = x + (((-1.0 / y) - -1.0) / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -950000.0], N[(x + N[(N[(N[(1.0 - x), $MachinePrecision] + N[(-1.0 / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 32000000000.0], N[(1.0 - N[(N[(y * N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(-1.0 / y), $MachinePrecision] - -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -950000:\\
\;\;\;\;x + \frac{\left(1 - x\right) + \frac{-1}{y}}{y}\\
\mathbf{elif}\;y \leq 32000000000:\\
\;\;\;\;1 - \frac{y \cdot \left(1 - x\right)}{1 + y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{-1}{y} - -1}{y}\\
\end{array}
\end{array}
if y < -9.5e5Initial program 28.7%
associate-/l*64.0%
+-commutative64.0%
Simplified64.0%
Taylor expanded in y around -inf 99.7%
mul-1-neg99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in x around 0 99.7%
if -9.5e5 < y < 3.2e10Initial program 99.9%
if 3.2e10 < y Initial program 29.3%
associate-/l*50.3%
+-commutative50.3%
Simplified50.3%
Taylor expanded in y around -inf 100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 5e-11) (- 1.0 y) (if (<= y 4e+83) (/ 1.0 y) x))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 5e-11) {
tmp = 1.0 - y;
} else if (y <= 4e+83) {
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 <= 5d-11) then
tmp = 1.0d0 - y
else if (y <= 4d+83) 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 <= 5e-11) {
tmp = 1.0 - y;
} else if (y <= 4e+83) {
tmp = 1.0 / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 5e-11: tmp = 1.0 - y elif y <= 4e+83: tmp = 1.0 / y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 5e-11) tmp = Float64(1.0 - y); elseif (y <= 4e+83) 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 <= 5e-11) tmp = 1.0 - y; elseif (y <= 4e+83) tmp = 1.0 / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 5e-11], N[(1.0 - y), $MachinePrecision], If[LessEqual[y, 4e+83], N[(1.0 / y), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-11}:\\
\;\;\;\;1 - y\\
\mathbf{elif}\;y \leq 4 \cdot 10^{+83}:\\
\;\;\;\;\frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 4.00000000000000012e83 < y Initial program 30.6%
associate-/l*60.9%
+-commutative60.9%
Simplified60.9%
Taylor expanded in y around inf 82.8%
if -1 < y < 5.00000000000000018e-11Initial program 100.0%
associate-/l*100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 78.3%
+-commutative78.3%
Simplified78.3%
Taylor expanded in y around 0 77.6%
neg-mul-177.6%
unsub-neg77.6%
Simplified77.6%
if 5.00000000000000018e-11 < y < 4.00000000000000012e83Initial program 44.5%
associate-/l*44.6%
+-commutative44.6%
Simplified44.6%
Taylor expanded in y around -inf 85.5%
associate-*r/85.5%
mul-1-neg85.5%
neg-sub085.5%
associate-+l-85.5%
neg-sub085.5%
+-commutative85.5%
sub-neg85.5%
Simplified85.5%
Taylor expanded in x around 0 60.4%
(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.1%
associate-/l*58.4%
+-commutative58.4%
Simplified58.4%
Taylor expanded in y around -inf 98.3%
associate-*r/98.3%
mul-1-neg98.3%
neg-sub098.3%
associate-+l-98.3%
neg-sub098.3%
+-commutative98.3%
sub-neg98.3%
Simplified98.3%
if -1 < y < 1Initial program 100.0%
associate-/l*100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 98.7%
Final simplification98.5%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 0.9))) (+ x (/ (- 1.0 x) y)) (+ -1.0 (- 2.0 y))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 0.9)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = -1.0 + (2.0 - y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-1.0d0)) .or. (.not. (y <= 0.9d0))) then
tmp = x + ((1.0d0 - x) / y)
else
tmp = (-1.0d0) + (2.0d0 - y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 0.9)) {
tmp = x + ((1.0 - x) / y);
} else {
tmp = -1.0 + (2.0 - y);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 0.9): tmp = x + ((1.0 - x) / y) else: tmp = -1.0 + (2.0 - y) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 0.9)) tmp = Float64(x + Float64(Float64(1.0 - x) / y)); else tmp = Float64(-1.0 + Float64(2.0 - y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.0) || ~((y <= 0.9))) tmp = x + ((1.0 - x) / y); else tmp = -1.0 + (2.0 - y); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 0.9]], $MachinePrecision]], N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(2.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 0.9\right):\\
\;\;\;\;x + \frac{1 - x}{y}\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(2 - y\right)\\
\end{array}
\end{array}
if y < -1 or 0.900000000000000022 < y Initial program 31.1%
associate-/l*58.4%
+-commutative58.4%
Simplified58.4%
Taylor expanded in y around -inf 98.3%
associate-*r/98.3%
mul-1-neg98.3%
neg-sub098.3%
associate-+l-98.3%
neg-sub098.3%
+-commutative98.3%
sub-neg98.3%
Simplified98.3%
if -1 < y < 0.900000000000000022Initial program 100.0%
associate-/l*100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 77.1%
+-commutative77.1%
Simplified77.1%
Taylor expanded in y around 0 76.4%
neg-mul-176.4%
unsub-neg76.4%
Simplified76.4%
expm1-log1p-u76.4%
Applied egg-rr76.4%
expm1-undefine76.4%
sub-neg76.4%
log1p-undefine76.4%
rem-exp-log76.4%
associate-+r-76.4%
metadata-eval76.4%
metadata-eval76.4%
Simplified76.4%
Final simplification87.6%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 5e-11))) (+ x (/ 1.0 y)) (+ -1.0 (- 2.0 y))))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 5e-11)) {
tmp = x + (1.0 / y);
} else {
tmp = -1.0 + (2.0 - y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-1.0d0)) .or. (.not. (y <= 5d-11))) then
tmp = x + (1.0d0 / y)
else
tmp = (-1.0d0) + (2.0d0 - y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 5e-11)) {
tmp = x + (1.0 / y);
} else {
tmp = -1.0 + (2.0 - y);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 5e-11): tmp = x + (1.0 / y) else: tmp = -1.0 + (2.0 - y) return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 5e-11)) tmp = Float64(x + Float64(1.0 / y)); else tmp = Float64(-1.0 + Float64(2.0 - y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.0) || ~((y <= 5e-11))) tmp = x + (1.0 / y); else tmp = -1.0 + (2.0 - y); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 5e-11]], $MachinePrecision]], N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(2.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 5 \cdot 10^{-11}\right):\\
\;\;\;\;x + \frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(2 - y\right)\\
\end{array}
\end{array}
if y < -1 or 5.00000000000000018e-11 < y Initial program 32.1%
associate-/l*59.0%
+-commutative59.0%
Simplified59.0%
Taylor expanded in y around -inf 96.8%
associate-*r/96.8%
mul-1-neg96.8%
neg-sub096.8%
associate-+l-96.8%
neg-sub096.8%
+-commutative96.8%
sub-neg96.8%
Simplified96.8%
Taylor expanded in x around 0 96.4%
if -1 < y < 5.00000000000000018e-11Initial program 100.0%
associate-/l*100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 78.3%
+-commutative78.3%
Simplified78.3%
Taylor expanded in y around 0 77.6%
neg-mul-177.6%
unsub-neg77.6%
Simplified77.6%
expm1-log1p-u77.6%
Applied egg-rr77.6%
expm1-undefine77.6%
sub-neg77.6%
log1p-undefine77.6%
rem-exp-log77.6%
associate-+r-77.6%
metadata-eval77.6%
metadata-eval77.6%
Simplified77.6%
Final simplification87.4%
(FPCore (x y) :precision binary64 (if (or (<= y -1.0) (not (<= y 5e-11))) (+ x (/ 1.0 y)) (- 1.0 y)))
double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 5e-11)) {
tmp = x + (1.0 / y);
} else {
tmp = 1.0 - y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-1.0d0)) .or. (.not. (y <= 5d-11))) then
tmp = x + (1.0d0 / y)
else
tmp = 1.0d0 - y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -1.0) || !(y <= 5e-11)) {
tmp = x + (1.0 / y);
} else {
tmp = 1.0 - y;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -1.0) or not (y <= 5e-11): tmp = x + (1.0 / y) else: tmp = 1.0 - y return tmp
function code(x, y) tmp = 0.0 if ((y <= -1.0) || !(y <= 5e-11)) tmp = Float64(x + Float64(1.0 / y)); else tmp = Float64(1.0 - y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -1.0) || ~((y <= 5e-11))) tmp = x + (1.0 / y); else tmp = 1.0 - y; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 5e-11]], $MachinePrecision]], N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision], N[(1.0 - y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 5 \cdot 10^{-11}\right):\\
\;\;\;\;x + \frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;1 - y\\
\end{array}
\end{array}
if y < -1 or 5.00000000000000018e-11 < y Initial program 32.1%
associate-/l*59.0%
+-commutative59.0%
Simplified59.0%
Taylor expanded in y around -inf 96.8%
associate-*r/96.8%
mul-1-neg96.8%
neg-sub096.8%
associate-+l-96.8%
neg-sub096.8%
+-commutative96.8%
sub-neg96.8%
Simplified96.8%
Taylor expanded in x around 0 96.4%
if -1 < y < 5.00000000000000018e-11Initial program 100.0%
associate-/l*100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 78.3%
+-commutative78.3%
Simplified78.3%
Taylor expanded in y around 0 77.6%
neg-mul-177.6%
unsub-neg77.6%
Simplified77.6%
Final simplification87.4%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 5e-11) (- 1.0 y) x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 5e-11) {
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 <= 5d-11) 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 <= 5e-11) {
tmp = 1.0 - y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 5e-11: tmp = 1.0 - y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 5e-11) 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 <= 5e-11) tmp = 1.0 - y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 5e-11], N[(1.0 - y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-11}:\\
\;\;\;\;1 - y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 5.00000000000000018e-11 < y Initial program 32.1%
associate-/l*59.0%
+-commutative59.0%
Simplified59.0%
Taylor expanded in y around inf 76.8%
if -1 < y < 5.00000000000000018e-11Initial program 100.0%
associate-/l*100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 78.3%
+-commutative78.3%
Simplified78.3%
Taylor expanded in y around 0 77.6%
neg-mul-177.6%
unsub-neg77.6%
Simplified77.6%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 5e-11) 1.0 x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 5e-11) {
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 <= 5d-11) 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 <= 5e-11) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 5e-11: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 5e-11) 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 <= 5e-11) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 5e-11], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-11}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 5.00000000000000018e-11 < y Initial program 32.1%
associate-/l*59.0%
+-commutative59.0%
Simplified59.0%
Taylor expanded in y around inf 76.8%
if -1 < y < 5.00000000000000018e-11Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
associate-/l*100.0%
distribute-rgt-neg-in100.0%
fma-define100.0%
distribute-neg-frac2100.0%
+-commutative100.0%
distribute-neg-in100.0%
metadata-eval100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 99.8%
mul-1-neg99.8%
distribute-neg-frac299.8%
distribute-rgt-neg-out99.8%
distribute-neg-in99.8%
metadata-eval99.8%
sub-neg99.8%
+-commutative99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 77.5%
(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 64.7%
sub-neg64.7%
+-commutative64.7%
associate-/l*78.7%
distribute-rgt-neg-in78.7%
fma-define78.7%
distribute-neg-frac278.7%
+-commutative78.7%
distribute-neg-in78.7%
metadata-eval78.7%
unsub-neg78.7%
Simplified78.7%
Taylor expanded in x around inf 78.9%
mul-1-neg78.9%
distribute-neg-frac278.9%
distribute-rgt-neg-out78.9%
distribute-neg-in78.9%
metadata-eval78.9%
sub-neg78.9%
+-commutative78.9%
+-commutative78.9%
Simplified78.9%
Taylor expanded in y around 0 39.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 2024182
(FPCore (x y)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, D"
:precision binary64
:alt
(! :herbie-platform default (if (< y -36938482788297247/10000000000000) (- (/ 1 y) (- (/ x y) x)) (if (< y 679931050341891/100000) (- 1 (/ (* (- 1 x) y) (+ y 1))) (- (/ 1 y) (- (/ x y) x)))))
(- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))