
(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 (pow (+ x -1.0) 2.0)))
(if (or (<= y -4500.0) (not (<= y 4.3e-5)))
(+
x
(/ 1.0 (* y (+ (/ (- (/ 1.0 t_0) (/ x t_0)) y) (/ -1.0 (+ x -1.0))))))
(- 1.0 (* (- 1.0 x) (/ y (+ y 1.0)))))))
double code(double x, double y) {
double t_0 = pow((x + -1.0), 2.0);
double tmp;
if ((y <= -4500.0) || !(y <= 4.3e-5)) {
tmp = x + (1.0 / (y * ((((1.0 / t_0) - (x / t_0)) / y) + (-1.0 / (x + -1.0)))));
} else {
tmp = 1.0 - ((1.0 - x) * (y / (y + 1.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)) ** 2.0d0
if ((y <= (-4500.0d0)) .or. (.not. (y <= 4.3d-5))) then
tmp = x + (1.0d0 / (y * ((((1.0d0 / t_0) - (x / t_0)) / y) + ((-1.0d0) / (x + (-1.0d0))))))
else
tmp = 1.0d0 - ((1.0d0 - x) * (y / (y + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = Math.pow((x + -1.0), 2.0);
double tmp;
if ((y <= -4500.0) || !(y <= 4.3e-5)) {
tmp = x + (1.0 / (y * ((((1.0 / t_0) - (x / t_0)) / y) + (-1.0 / (x + -1.0)))));
} else {
tmp = 1.0 - ((1.0 - x) * (y / (y + 1.0)));
}
return tmp;
}
def code(x, y): t_0 = math.pow((x + -1.0), 2.0) tmp = 0 if (y <= -4500.0) or not (y <= 4.3e-5): tmp = x + (1.0 / (y * ((((1.0 / t_0) - (x / t_0)) / y) + (-1.0 / (x + -1.0))))) else: tmp = 1.0 - ((1.0 - x) * (y / (y + 1.0))) return tmp
function code(x, y) t_0 = Float64(x + -1.0) ^ 2.0 tmp = 0.0 if ((y <= -4500.0) || !(y <= 4.3e-5)) tmp = Float64(x + Float64(1.0 / Float64(y * Float64(Float64(Float64(Float64(1.0 / t_0) - Float64(x / t_0)) / y) + Float64(-1.0 / Float64(x + -1.0)))))); else tmp = Float64(1.0 - Float64(Float64(1.0 - x) * Float64(y / Float64(y + 1.0)))); end return tmp end
function tmp_2 = code(x, y) t_0 = (x + -1.0) ^ 2.0; tmp = 0.0; if ((y <= -4500.0) || ~((y <= 4.3e-5))) tmp = x + (1.0 / (y * ((((1.0 / t_0) - (x / t_0)) / y) + (-1.0 / (x + -1.0))))); else tmp = 1.0 - ((1.0 - x) * (y / (y + 1.0))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[Power[N[(x + -1.0), $MachinePrecision], 2.0], $MachinePrecision]}, If[Or[LessEqual[y, -4500.0], N[Not[LessEqual[y, 4.3e-5]], $MachinePrecision]], N[(x + N[(1.0 / N[(y * N[(N[(N[(N[(1.0 / t$95$0), $MachinePrecision] - N[(x / t$95$0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] + N[(-1.0 / N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(1.0 - x), $MachinePrecision] * N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + -1\right)}^{2}\\
\mathbf{if}\;y \leq -4500 \lor \neg \left(y \leq 4.3 \cdot 10^{-5}\right):\\
\;\;\;\;x + \frac{1}{y \cdot \left(\frac{\frac{1}{t\_0} - \frac{x}{t\_0}}{y} + \frac{-1}{x + -1}\right)}\\
\mathbf{else}:\\
\;\;\;\;1 - \left(1 - x\right) \cdot \frac{y}{y + 1}\\
\end{array}
\end{array}
if y < -4500 or 4.3000000000000002e-5 < y Initial program 36.3%
associate-/l*58.4%
remove-double-neg58.4%
remove-double-neg58.4%
+-commutative58.4%
Simplified58.4%
Taylor expanded in y around -inf 98.1%
Simplified98.1%
clear-num98.1%
inv-pow98.1%
associate-+l+98.1%
Applied egg-rr98.1%
unpow-198.1%
Simplified98.1%
Taylor expanded in y around -inf 100.0%
associate-*r*100.0%
neg-mul-1100.0%
associate-*r/100.0%
mul-1-neg100.0%
sub-neg100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
if -4500 < y < 4.3000000000000002e-5Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* y (- 1.0 x)) (+ y 1.0))))
(if (or (<= t_0 0.9999) (not (<= t_0 1.0001)))
(- 1.0 (* (- 1.0 x) (/ y (+ y 1.0))))
(+ x (/ -1.0 (/ y (+ -1.0 (/ 1.0 y))))))))
double code(double x, double y) {
double t_0 = (y * (1.0 - x)) / (y + 1.0);
double tmp;
if ((t_0 <= 0.9999) || !(t_0 <= 1.0001)) {
tmp = 1.0 - ((1.0 - x) * (y / (y + 1.0)));
} else {
tmp = x + (-1.0 / (y / (-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) :: t_0
real(8) :: tmp
t_0 = (y * (1.0d0 - x)) / (y + 1.0d0)
if ((t_0 <= 0.9999d0) .or. (.not. (t_0 <= 1.0001d0))) then
tmp = 1.0d0 - ((1.0d0 - x) * (y / (y + 1.0d0)))
else
tmp = x + ((-1.0d0) / (y / ((-1.0d0) + (1.0d0 / y))))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y * (1.0 - x)) / (y + 1.0);
double tmp;
if ((t_0 <= 0.9999) || !(t_0 <= 1.0001)) {
tmp = 1.0 - ((1.0 - x) * (y / (y + 1.0)));
} else {
tmp = x + (-1.0 / (y / (-1.0 + (1.0 / y))));
}
return tmp;
}
def code(x, y): t_0 = (y * (1.0 - x)) / (y + 1.0) tmp = 0 if (t_0 <= 0.9999) or not (t_0 <= 1.0001): tmp = 1.0 - ((1.0 - x) * (y / (y + 1.0))) else: tmp = x + (-1.0 / (y / (-1.0 + (1.0 / y)))) return tmp
function code(x, y) t_0 = Float64(Float64(y * Float64(1.0 - x)) / Float64(y + 1.0)) tmp = 0.0 if ((t_0 <= 0.9999) || !(t_0 <= 1.0001)) tmp = Float64(1.0 - Float64(Float64(1.0 - x) * Float64(y / Float64(y + 1.0)))); else tmp = Float64(x + Float64(-1.0 / Float64(y / Float64(-1.0 + Float64(1.0 / y))))); end return tmp end
function tmp_2 = code(x, y) t_0 = (y * (1.0 - x)) / (y + 1.0); tmp = 0.0; if ((t_0 <= 0.9999) || ~((t_0 <= 1.0001))) tmp = 1.0 - ((1.0 - x) * (y / (y + 1.0))); else tmp = x + (-1.0 / (y / (-1.0 + (1.0 / y)))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y * N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, 0.9999], N[Not[LessEqual[t$95$0, 1.0001]], $MachinePrecision]], N[(1.0 - N[(N[(1.0 - x), $MachinePrecision] * N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(-1.0 / N[(y / N[(-1.0 + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y \cdot \left(1 - x\right)}{y + 1}\\
\mathbf{if}\;t\_0 \leq 0.9999 \lor \neg \left(t\_0 \leq 1.0001\right):\\
\;\;\;\;1 - \left(1 - x\right) \cdot \frac{y}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{-1}{\frac{y}{-1 + \frac{1}{y}}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 0.99990000000000001 or 1.00009999999999999 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) Initial program 85.8%
associate-/l*99.8%
remove-double-neg99.8%
remove-double-neg99.8%
+-commutative99.8%
Simplified99.8%
if 0.99990000000000001 < (/.f64 (*.f64 (-.f64 #s(literal 1 binary64) x) y) (+.f64 y #s(literal 1 binary64))) < 1.00009999999999999Initial program 6.4%
associate-/l*6.4%
remove-double-neg6.4%
remove-double-neg6.4%
+-commutative6.4%
Simplified6.4%
Taylor expanded in y around -inf 99.9%
Simplified99.9%
clear-num100.0%
inv-pow100.0%
associate-+l+100.0%
Applied egg-rr100.0%
unpow-1100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
Final simplification99.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ x (/ (- 1.0 x) y))))
(if (<= y -7000.0)
t_0
(if (<= y -1.22e-85)
(* x (/ y (+ y 1.0)))
(if (<= y 0.92) (- 1.0 y) t_0)))))
double code(double x, double y) {
double t_0 = x + ((1.0 - x) / y);
double tmp;
if (y <= -7000.0) {
tmp = t_0;
} else if (y <= -1.22e-85) {
tmp = x * (y / (y + 1.0));
} else if (y <= 0.92) {
tmp = 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 <= (-7000.0d0)) then
tmp = t_0
else if (y <= (-1.22d-85)) then
tmp = x * (y / (y + 1.0d0))
else if (y <= 0.92d0) then
tmp = 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 <= -7000.0) {
tmp = t_0;
} else if (y <= -1.22e-85) {
tmp = x * (y / (y + 1.0));
} else if (y <= 0.92) {
tmp = 1.0 - y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x + ((1.0 - x) / y) tmp = 0 if y <= -7000.0: tmp = t_0 elif y <= -1.22e-85: tmp = x * (y / (y + 1.0)) elif y <= 0.92: tmp = 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 <= -7000.0) tmp = t_0; elseif (y <= -1.22e-85) tmp = Float64(x * Float64(y / Float64(y + 1.0))); elseif (y <= 0.92) tmp = 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 <= -7000.0) tmp = t_0; elseif (y <= -1.22e-85) tmp = x * (y / (y + 1.0)); elseif (y <= 0.92) tmp = 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, -7000.0], t$95$0, If[LessEqual[y, -1.22e-85], N[(x * N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.92], N[(1.0 - y), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \frac{1 - x}{y}\\
\mathbf{if}\;y \leq -7000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -1.22 \cdot 10^{-85}:\\
\;\;\;\;x \cdot \frac{y}{y + 1}\\
\mathbf{elif}\;y \leq 0.92:\\
\;\;\;\;1 - y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -7e3 or 0.92000000000000004 < y Initial program 35.8%
associate-/l*58.0%
remove-double-neg58.0%
remove-double-neg58.0%
+-commutative58.0%
Simplified58.0%
Taylor expanded in y around -inf 98.1%
mul-1-neg98.1%
distribute-frac-neg98.1%
neg-sub098.1%
associate-+l-98.1%
neg-sub098.1%
+-commutative98.1%
sub-neg98.1%
Simplified98.1%
if -7e3 < y < -1.22000000000000006e-85Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 64.7%
associate-/l*64.7%
+-commutative64.7%
Simplified64.7%
if -1.22000000000000006e-85 < y < 0.92000000000000004Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
sub-neg100.0%
associate-*r/100.0%
+-commutative100.0%
+-commutative100.0%
+-commutative100.0%
associate-*r/100.0%
distribute-lft-neg-in100.0%
add-cube-cbrt99.5%
associate-*r*99.6%
fma-define99.6%
pow299.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 75.5%
mul-1-neg75.5%
unpow275.5%
unpow275.5%
times-frac75.5%
unpow275.5%
Simplified75.5%
Taylor expanded in y around 0 75.2%
neg-mul-175.2%
unsub-neg75.2%
Simplified75.2%
(FPCore (x y)
:precision binary64
(if (<= y -380000.0)
(- x (/ 1.0 (/ y (- -1.0 (- (/ (+ x -1.0) y) x)))))
(if (<= y 580000000000.0)
(- 1.0 (* (- 1.0 x) (/ y (+ y 1.0))))
(+ x (/ 1.0 y)))))
double code(double x, double y) {
double tmp;
if (y <= -380000.0) {
tmp = x - (1.0 / (y / (-1.0 - (((x + -1.0) / y) - x))));
} else if (y <= 580000000000.0) {
tmp = 1.0 - ((1.0 - x) * (y / (y + 1.0)));
} else {
tmp = 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 <= (-380000.0d0)) then
tmp = x - (1.0d0 / (y / ((-1.0d0) - (((x + (-1.0d0)) / y) - x))))
else if (y <= 580000000000.0d0) then
tmp = 1.0d0 - ((1.0d0 - x) * (y / (y + 1.0d0)))
else
tmp = x + (1.0d0 / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -380000.0) {
tmp = x - (1.0 / (y / (-1.0 - (((x + -1.0) / y) - x))));
} else if (y <= 580000000000.0) {
tmp = 1.0 - ((1.0 - x) * (y / (y + 1.0)));
} else {
tmp = x + (1.0 / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -380000.0: tmp = x - (1.0 / (y / (-1.0 - (((x + -1.0) / y) - x)))) elif y <= 580000000000.0: tmp = 1.0 - ((1.0 - x) * (y / (y + 1.0))) else: tmp = x + (1.0 / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -380000.0) tmp = Float64(x - Float64(1.0 / Float64(y / Float64(-1.0 - Float64(Float64(Float64(x + -1.0) / y) - x))))); elseif (y <= 580000000000.0) tmp = Float64(1.0 - Float64(Float64(1.0 - x) * Float64(y / Float64(y + 1.0)))); else tmp = Float64(x + Float64(1.0 / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -380000.0) tmp = x - (1.0 / (y / (-1.0 - (((x + -1.0) / y) - x)))); elseif (y <= 580000000000.0) tmp = 1.0 - ((1.0 - x) * (y / (y + 1.0))); else tmp = x + (1.0 / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -380000.0], N[(x - N[(1.0 / N[(y / N[(-1.0 - N[(N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 580000000000.0], N[(1.0 - N[(N[(1.0 - x), $MachinePrecision] * N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -380000:\\
\;\;\;\;x - \frac{1}{\frac{y}{-1 - \left(\frac{x + -1}{y} - x\right)}}\\
\mathbf{elif}\;y \leq 580000000000:\\
\;\;\;\;1 - \left(1 - x\right) \cdot \frac{y}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{y}\\
\end{array}
\end{array}
if y < -3.8e5Initial program 33.0%
associate-/l*60.5%
remove-double-neg60.5%
remove-double-neg60.5%
+-commutative60.5%
Simplified60.5%
Taylor expanded in y around -inf 100.0%
Simplified100.0%
clear-num100.0%
inv-pow100.0%
associate-+l+100.0%
Applied egg-rr100.0%
unpow-1100.0%
Simplified100.0%
if -3.8e5 < y < 5.8e11Initial program 99.7%
associate-/l*99.7%
remove-double-neg99.7%
remove-double-neg99.7%
+-commutative99.7%
Simplified99.7%
if 5.8e11 < y Initial program 35.2%
associate-/l*53.1%
remove-double-neg53.1%
remove-double-neg53.1%
+-commutative53.1%
Simplified53.1%
Taylor expanded in y around -inf 100.0%
mul-1-neg100.0%
distribute-frac-neg100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
Final simplification99.8%
(FPCore (x y)
:precision binary64
(if (<= y -410000.0)
(+ x (/ (+ (- 1.0 x) (/ (+ x -1.0) y)) y))
(if (<= y 1060000000000.0)
(- 1.0 (* (- 1.0 x) (/ y (+ y 1.0))))
(+ x (/ 1.0 y)))))
double code(double x, double y) {
double tmp;
if (y <= -410000.0) {
tmp = x + (((1.0 - x) + ((x + -1.0) / y)) / y);
} else if (y <= 1060000000000.0) {
tmp = 1.0 - ((1.0 - x) * (y / (y + 1.0)));
} else {
tmp = 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 <= (-410000.0d0)) then
tmp = x + (((1.0d0 - x) + ((x + (-1.0d0)) / y)) / y)
else if (y <= 1060000000000.0d0) then
tmp = 1.0d0 - ((1.0d0 - x) * (y / (y + 1.0d0)))
else
tmp = x + (1.0d0 / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -410000.0) {
tmp = x + (((1.0 - x) + ((x + -1.0) / y)) / y);
} else if (y <= 1060000000000.0) {
tmp = 1.0 - ((1.0 - x) * (y / (y + 1.0)));
} else {
tmp = x + (1.0 / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -410000.0: tmp = x + (((1.0 - x) + ((x + -1.0) / y)) / y) elif y <= 1060000000000.0: tmp = 1.0 - ((1.0 - x) * (y / (y + 1.0))) else: tmp = x + (1.0 / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -410000.0) tmp = Float64(x + Float64(Float64(Float64(1.0 - x) + Float64(Float64(x + -1.0) / y)) / y)); elseif (y <= 1060000000000.0) tmp = Float64(1.0 - Float64(Float64(1.0 - x) * Float64(y / Float64(y + 1.0)))); else tmp = Float64(x + Float64(1.0 / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -410000.0) tmp = x + (((1.0 - x) + ((x + -1.0) / y)) / y); elseif (y <= 1060000000000.0) tmp = 1.0 - ((1.0 - x) * (y / (y + 1.0))); else tmp = x + (1.0 / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -410000.0], N[(x + N[(N[(N[(1.0 - x), $MachinePrecision] + N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1060000000000.0], N[(1.0 - N[(N[(1.0 - x), $MachinePrecision] * N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -410000:\\
\;\;\;\;x + \frac{\left(1 - x\right) + \frac{x + -1}{y}}{y}\\
\mathbf{elif}\;y \leq 1060000000000:\\
\;\;\;\;1 - \left(1 - x\right) \cdot \frac{y}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{y}\\
\end{array}
\end{array}
if y < -4.1e5Initial program 33.0%
associate-/l*60.5%
remove-double-neg60.5%
remove-double-neg60.5%
+-commutative60.5%
Simplified60.5%
Taylor expanded in y around -inf 100.0%
Simplified100.0%
if -4.1e5 < y < 1.06e12Initial program 99.7%
associate-/l*99.7%
remove-double-neg99.7%
remove-double-neg99.7%
+-commutative99.7%
Simplified99.7%
if 1.06e12 < y Initial program 35.2%
associate-/l*53.1%
remove-double-neg53.1%
remove-double-neg53.1%
+-commutative53.1%
Simplified53.1%
Taylor expanded in y around -inf 100.0%
mul-1-neg100.0%
distribute-frac-neg100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
Final simplification99.8%
(FPCore (x y)
:precision binary64
(if (<= y -260000000000.0)
(+ x (/ (* x (+ -1.0 (/ 1.0 x))) y))
(if (<= y 11600000000.0)
(- 1.0 (* (- 1.0 x) (/ y (+ y 1.0))))
(+ x (/ 1.0 y)))))
double code(double x, double y) {
double tmp;
if (y <= -260000000000.0) {
tmp = x + ((x * (-1.0 + (1.0 / x))) / y);
} else if (y <= 11600000000.0) {
tmp = 1.0 - ((1.0 - x) * (y / (y + 1.0)));
} else {
tmp = 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 <= (-260000000000.0d0)) then
tmp = x + ((x * ((-1.0d0) + (1.0d0 / x))) / y)
else if (y <= 11600000000.0d0) then
tmp = 1.0d0 - ((1.0d0 - x) * (y / (y + 1.0d0)))
else
tmp = x + (1.0d0 / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -260000000000.0) {
tmp = x + ((x * (-1.0 + (1.0 / x))) / y);
} else if (y <= 11600000000.0) {
tmp = 1.0 - ((1.0 - x) * (y / (y + 1.0)));
} else {
tmp = x + (1.0 / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -260000000000.0: tmp = x + ((x * (-1.0 + (1.0 / x))) / y) elif y <= 11600000000.0: tmp = 1.0 - ((1.0 - x) * (y / (y + 1.0))) else: tmp = x + (1.0 / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -260000000000.0) tmp = Float64(x + Float64(Float64(x * Float64(-1.0 + Float64(1.0 / x))) / y)); elseif (y <= 11600000000.0) tmp = Float64(1.0 - Float64(Float64(1.0 - x) * Float64(y / Float64(y + 1.0)))); else tmp = Float64(x + Float64(1.0 / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -260000000000.0) tmp = x + ((x * (-1.0 + (1.0 / x))) / y); elseif (y <= 11600000000.0) tmp = 1.0 - ((1.0 - x) * (y / (y + 1.0))); else tmp = x + (1.0 / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -260000000000.0], N[(x + N[(N[(x * N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 11600000000.0], N[(1.0 - N[(N[(1.0 - x), $MachinePrecision] * N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -260000000000:\\
\;\;\;\;x + \frac{x \cdot \left(-1 + \frac{1}{x}\right)}{y}\\
\mathbf{elif}\;y \leq 11600000000:\\
\;\;\;\;1 - \left(1 - x\right) \cdot \frac{y}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{y}\\
\end{array}
\end{array}
if y < -2.6e11Initial program 31.4%
associate-/l*59.8%
remove-double-neg59.8%
remove-double-neg59.8%
+-commutative59.8%
Simplified59.8%
Taylor expanded in y around -inf 100.0%
mul-1-neg100.0%
distribute-frac-neg100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if -2.6e11 < y < 1.16e10Initial program 99.4%
associate-/l*99.4%
remove-double-neg99.4%
remove-double-neg99.4%
+-commutative99.4%
Simplified99.4%
if 1.16e10 < y Initial program 35.2%
associate-/l*53.1%
remove-double-neg53.1%
remove-double-neg53.1%
+-commutative53.1%
Simplified53.1%
Taylor expanded in y around -inf 100.0%
mul-1-neg100.0%
distribute-frac-neg100.0%
neg-sub0100.0%
associate-+l-100.0%
neg-sub0100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
Final simplification99.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ x (/ 1.0 y))))
(if (<= y -7200.0)
t_0
(if (<= y -2.05e-82)
(* x (/ y (+ y 1.0)))
(if (<= y 0.0115) (- 1.0 y) t_0)))))
double code(double x, double y) {
double t_0 = x + (1.0 / y);
double tmp;
if (y <= -7200.0) {
tmp = t_0;
} else if (y <= -2.05e-82) {
tmp = x * (y / (y + 1.0));
} else if (y <= 0.0115) {
tmp = 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 / y)
if (y <= (-7200.0d0)) then
tmp = t_0
else if (y <= (-2.05d-82)) then
tmp = x * (y / (y + 1.0d0))
else if (y <= 0.0115d0) then
tmp = 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 / y);
double tmp;
if (y <= -7200.0) {
tmp = t_0;
} else if (y <= -2.05e-82) {
tmp = x * (y / (y + 1.0));
} else if (y <= 0.0115) {
tmp = 1.0 - y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x + (1.0 / y) tmp = 0 if y <= -7200.0: tmp = t_0 elif y <= -2.05e-82: tmp = x * (y / (y + 1.0)) elif y <= 0.0115: tmp = 1.0 - y else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x + Float64(1.0 / y)) tmp = 0.0 if (y <= -7200.0) tmp = t_0; elseif (y <= -2.05e-82) tmp = Float64(x * Float64(y / Float64(y + 1.0))); elseif (y <= 0.0115) tmp = Float64(1.0 - y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = x + (1.0 / y); tmp = 0.0; if (y <= -7200.0) tmp = t_0; elseif (y <= -2.05e-82) tmp = x * (y / (y + 1.0)); elseif (y <= 0.0115) tmp = 1.0 - y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7200.0], t$95$0, If[LessEqual[y, -2.05e-82], N[(x * N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.0115], N[(1.0 - y), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \frac{1}{y}\\
\mathbf{if}\;y \leq -7200:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -2.05 \cdot 10^{-82}:\\
\;\;\;\;x \cdot \frac{y}{y + 1}\\
\mathbf{elif}\;y \leq 0.0115:\\
\;\;\;\;1 - y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -7200 or 0.0115 < y Initial program 35.8%
associate-/l*58.0%
remove-double-neg58.0%
remove-double-neg58.0%
+-commutative58.0%
Simplified58.0%
Taylor expanded in y around -inf 98.1%
mul-1-neg98.1%
distribute-frac-neg98.1%
neg-sub098.1%
associate-+l-98.1%
neg-sub098.1%
+-commutative98.1%
sub-neg98.1%
Simplified98.1%
Taylor expanded in x around 0 97.4%
if -7200 < y < -2.04999999999999998e-82Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 64.7%
associate-/l*64.7%
+-commutative64.7%
Simplified64.7%
if -2.04999999999999998e-82 < y < 0.0115Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
sub-neg100.0%
associate-*r/100.0%
+-commutative100.0%
+-commutative100.0%
+-commutative100.0%
associate-*r/100.0%
distribute-lft-neg-in100.0%
add-cube-cbrt99.5%
associate-*r*99.6%
fma-define99.6%
pow299.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 75.5%
mul-1-neg75.5%
unpow275.5%
unpow275.5%
times-frac75.5%
unpow275.5%
Simplified75.5%
Taylor expanded in y around 0 75.2%
neg-mul-175.2%
unsub-neg75.2%
Simplified75.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ x (/ 1.0 y))))
(if (<= y -1.0)
t_0
(if (<= y -9.2e-80) (* y x) (if (<= y 0.065) (- 1.0 y) t_0)))))
double code(double x, double y) {
double t_0 = x + (1.0 / y);
double tmp;
if (y <= -1.0) {
tmp = t_0;
} else if (y <= -9.2e-80) {
tmp = y * x;
} else if (y <= 0.065) {
tmp = 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 / y)
if (y <= (-1.0d0)) then
tmp = t_0
else if (y <= (-9.2d-80)) then
tmp = y * x
else if (y <= 0.065d0) then
tmp = 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 / y);
double tmp;
if (y <= -1.0) {
tmp = t_0;
} else if (y <= -9.2e-80) {
tmp = y * x;
} else if (y <= 0.065) {
tmp = 1.0 - y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x + (1.0 / y) tmp = 0 if y <= -1.0: tmp = t_0 elif y <= -9.2e-80: tmp = y * x elif y <= 0.065: tmp = 1.0 - y else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x + Float64(1.0 / y)) tmp = 0.0 if (y <= -1.0) tmp = t_0; elseif (y <= -9.2e-80) tmp = Float64(y * x); elseif (y <= 0.065) tmp = Float64(1.0 - y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = x + (1.0 / y); tmp = 0.0; if (y <= -1.0) tmp = t_0; elseif (y <= -9.2e-80) tmp = y * x; elseif (y <= 0.065) tmp = 1.0 - y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.0], t$95$0, If[LessEqual[y, -9.2e-80], N[(y * x), $MachinePrecision], If[LessEqual[y, 0.065], N[(1.0 - y), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \frac{1}{y}\\
\mathbf{if}\;y \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -9.2 \cdot 10^{-80}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 0.065:\\
\;\;\;\;1 - y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1 or 0.065000000000000002 < y Initial program 35.8%
associate-/l*58.0%
remove-double-neg58.0%
remove-double-neg58.0%
+-commutative58.0%
Simplified58.0%
Taylor expanded in y around -inf 98.1%
mul-1-neg98.1%
distribute-frac-neg98.1%
neg-sub098.1%
associate-+l-98.1%
neg-sub098.1%
+-commutative98.1%
sub-neg98.1%
Simplified98.1%
Taylor expanded in x around 0 97.4%
if -1 < y < -9.1999999999999993e-80Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 64.7%
associate-/l*64.7%
+-commutative64.7%
Simplified64.7%
Taylor expanded in y around 0 61.5%
*-commutative61.5%
Simplified61.5%
if -9.1999999999999993e-80 < y < 0.065000000000000002Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
sub-neg100.0%
associate-*r/100.0%
+-commutative100.0%
+-commutative100.0%
+-commutative100.0%
associate-*r/100.0%
distribute-lft-neg-in100.0%
add-cube-cbrt99.5%
associate-*r*99.6%
fma-define99.6%
pow299.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 75.5%
mul-1-neg75.5%
unpow275.5%
unpow275.5%
times-frac75.5%
unpow275.5%
Simplified75.5%
Taylor expanded in y around 0 75.2%
neg-mul-175.2%
unsub-neg75.2%
Simplified75.2%
(FPCore (x y) :precision binary64 (if (<= y -1.0) (+ x (/ (* x (+ -1.0 (/ 1.0 x))) y)) (if (<= y 1.0) (+ 1.0 (* y (+ x -1.0))) (- (+ x (/ 1.0 y)) (/ x y)))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x + ((x * (-1.0 + (1.0 / x))) / y);
} else if (y <= 1.0) {
tmp = 1.0 + (y * (x + -1.0));
} else {
tmp = (x + (1.0 / y)) - (x / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.0d0)) then
tmp = x + ((x * ((-1.0d0) + (1.0d0 / x))) / y)
else if (y <= 1.0d0) then
tmp = 1.0d0 + (y * (x + (-1.0d0)))
else
tmp = (x + (1.0d0 / y)) - (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x + ((x * (-1.0 + (1.0 / x))) / y);
} else if (y <= 1.0) {
tmp = 1.0 + (y * (x + -1.0));
} else {
tmp = (x + (1.0 / y)) - (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x + ((x * (-1.0 + (1.0 / x))) / y) elif y <= 1.0: tmp = 1.0 + (y * (x + -1.0)) else: tmp = (x + (1.0 / y)) - (x / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = Float64(x + Float64(Float64(x * Float64(-1.0 + Float64(1.0 / x))) / y)); elseif (y <= 1.0) tmp = Float64(1.0 + Float64(y * Float64(x + -1.0))); else tmp = Float64(Float64(x + Float64(1.0 / y)) - Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = x + ((x * (-1.0 + (1.0 / x))) / y); elseif (y <= 1.0) tmp = 1.0 + (y * (x + -1.0)); else tmp = (x + (1.0 / y)) - (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], N[(x + N[(N[(x * N[(-1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(1.0 + N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision] - N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x + \frac{x \cdot \left(-1 + \frac{1}{x}\right)}{y}\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;1 + y \cdot \left(x + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + \frac{1}{y}\right) - \frac{x}{y}\\
\end{array}
\end{array}
if y < -1Initial program 33.8%
associate-/l*60.8%
remove-double-neg60.8%
remove-double-neg60.8%
+-commutative60.8%
Simplified60.8%
Taylor expanded in y around -inf 98.4%
mul-1-neg98.4%
distribute-frac-neg98.4%
neg-sub098.4%
associate-+l-98.4%
neg-sub098.4%
+-commutative98.4%
sub-neg98.4%
Simplified98.4%
Taylor expanded in x around inf 98.4%
if -1 < y < 1Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 98.3%
if 1 < y Initial program 38.1%
associate-/l*55.0%
remove-double-neg55.0%
remove-double-neg55.0%
+-commutative55.0%
Simplified55.0%
Taylor expanded in y around inf 97.7%
Final simplification98.2%
(FPCore (x y) :precision binary64 (if (<= y -1.0) (+ x (/ (- 1.0 x) y)) (if (<= y 1.0) (+ 1.0 (* y (+ x -1.0))) (- (+ x (/ 1.0 y)) (/ x y)))))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x + ((1.0 - x) / y);
} else if (y <= 1.0) {
tmp = 1.0 + (y * (x + -1.0));
} else {
tmp = (x + (1.0 / y)) - (x / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-1.0d0)) then
tmp = x + ((1.0d0 - x) / y)
else if (y <= 1.0d0) then
tmp = 1.0d0 + (y * (x + (-1.0d0)))
else
tmp = (x + (1.0d0 / y)) - (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x + ((1.0 - x) / y);
} else if (y <= 1.0) {
tmp = 1.0 + (y * (x + -1.0));
} else {
tmp = (x + (1.0 / y)) - (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x + ((1.0 - x) / y) elif y <= 1.0: tmp = 1.0 + (y * (x + -1.0)) else: tmp = (x + (1.0 / y)) - (x / y) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = Float64(x + Float64(Float64(1.0 - x) / y)); elseif (y <= 1.0) tmp = Float64(1.0 + Float64(y * Float64(x + -1.0))); else tmp = Float64(Float64(x + Float64(1.0 / y)) - Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -1.0) tmp = x + ((1.0 - x) / y); elseif (y <= 1.0) tmp = 1.0 + (y * (x + -1.0)); else tmp = (x + (1.0 / y)) - (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(1.0 + N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision] - N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x + \frac{1 - x}{y}\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;1 + y \cdot \left(x + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + \frac{1}{y}\right) - \frac{x}{y}\\
\end{array}
\end{array}
if y < -1Initial program 33.8%
associate-/l*60.8%
remove-double-neg60.8%
remove-double-neg60.8%
+-commutative60.8%
Simplified60.8%
Taylor expanded in y around -inf 98.4%
mul-1-neg98.4%
distribute-frac-neg98.4%
neg-sub098.4%
associate-+l-98.4%
neg-sub098.4%
+-commutative98.4%
sub-neg98.4%
Simplified98.4%
if -1 < y < 1Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 98.3%
if 1 < y Initial program 38.1%
associate-/l*55.0%
remove-double-neg55.0%
remove-double-neg55.0%
+-commutative55.0%
Simplified55.0%
Taylor expanded in y around inf 97.7%
Final simplification98.2%
(FPCore (x y) :precision binary64 (if (<= y -7500.0) x (if (<= y -3e-85) (* y x) (if (<= y 0.039) (- 1.0 y) x))))
double code(double x, double y) {
double tmp;
if (y <= -7500.0) {
tmp = x;
} else if (y <= -3e-85) {
tmp = y * x;
} else if (y <= 0.039) {
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 <= (-7500.0d0)) then
tmp = x
else if (y <= (-3d-85)) then
tmp = y * x
else if (y <= 0.039d0) 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 <= -7500.0) {
tmp = x;
} else if (y <= -3e-85) {
tmp = y * x;
} else if (y <= 0.039) {
tmp = 1.0 - y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7500.0: tmp = x elif y <= -3e-85: tmp = y * x elif y <= 0.039: tmp = 1.0 - y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -7500.0) tmp = x; elseif (y <= -3e-85) tmp = Float64(y * x); elseif (y <= 0.039) tmp = Float64(1.0 - y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -7500.0) tmp = x; elseif (y <= -3e-85) tmp = y * x; elseif (y <= 0.039) tmp = 1.0 - y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7500.0], x, If[LessEqual[y, -3e-85], N[(y * x), $MachinePrecision], If[LessEqual[y, 0.039], N[(1.0 - y), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7500:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -3 \cdot 10^{-85}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 0.039:\\
\;\;\;\;1 - y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -7500 or 0.0389999999999999999 < y Initial program 35.5%
associate-/l*57.8%
remove-double-neg57.8%
remove-double-neg57.8%
+-commutative57.8%
Simplified57.8%
Taylor expanded in y around inf 77.9%
if -7500 < y < -3.00000000000000022e-85Initial program 99.2%
associate-/l*99.2%
remove-double-neg99.2%
remove-double-neg99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in x around inf 62.0%
associate-/l*62.0%
+-commutative62.0%
Simplified62.0%
Taylor expanded in y around 0 59.1%
*-commutative59.1%
Simplified59.1%
if -3.00000000000000022e-85 < y < 0.0389999999999999999Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
sub-neg100.0%
associate-*r/100.0%
+-commutative100.0%
+-commutative100.0%
+-commutative100.0%
associate-*r/100.0%
distribute-lft-neg-in100.0%
add-cube-cbrt99.5%
associate-*r*99.6%
fma-define99.6%
pow299.6%
Applied egg-rr99.6%
Taylor expanded in x around 0 75.5%
mul-1-neg75.5%
unpow275.5%
unpow275.5%
times-frac75.5%
unpow275.5%
Simplified75.5%
Taylor expanded in y around 0 75.2%
neg-mul-175.2%
unsub-neg75.2%
Simplified75.2%
(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 35.8%
associate-/l*58.0%
remove-double-neg58.0%
remove-double-neg58.0%
+-commutative58.0%
Simplified58.0%
Taylor expanded in y around -inf 98.1%
mul-1-neg98.1%
distribute-frac-neg98.1%
neg-sub098.1%
associate-+l-98.1%
neg-sub098.1%
+-commutative98.1%
sub-neg98.1%
Simplified98.1%
if -1 < y < 1Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 98.3%
Final simplification98.2%
(FPCore (x y) :precision binary64 (if (<= y -7500.0) x (if (<= y -1.85e-82) (* y x) (if (<= y 10000.0) 1.0 x))))
double code(double x, double y) {
double tmp;
if (y <= -7500.0) {
tmp = x;
} else if (y <= -1.85e-82) {
tmp = y * x;
} else if (y <= 10000.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 <= (-7500.0d0)) then
tmp = x
else if (y <= (-1.85d-82)) then
tmp = y * x
else if (y <= 10000.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 <= -7500.0) {
tmp = x;
} else if (y <= -1.85e-82) {
tmp = y * x;
} else if (y <= 10000.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7500.0: tmp = x elif y <= -1.85e-82: tmp = y * x elif y <= 10000.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -7500.0) tmp = x; elseif (y <= -1.85e-82) tmp = Float64(y * x); elseif (y <= 10000.0) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -7500.0) tmp = x; elseif (y <= -1.85e-82) tmp = y * x; elseif (y <= 10000.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7500.0], x, If[LessEqual[y, -1.85e-82], N[(y * x), $MachinePrecision], If[LessEqual[y, 10000.0], 1.0, x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7500:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1.85 \cdot 10^{-82}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 10000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -7500 or 1e4 < y Initial program 34.6%
associate-/l*57.3%
remove-double-neg57.3%
remove-double-neg57.3%
+-commutative57.3%
Simplified57.3%
Taylor expanded in y around inf 79.1%
if -7500 < y < -1.85e-82Initial program 99.2%
associate-/l*99.2%
remove-double-neg99.2%
remove-double-neg99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in x around inf 62.0%
associate-/l*62.0%
+-commutative62.0%
Simplified62.0%
Taylor expanded in y around 0 59.1%
*-commutative59.1%
Simplified59.1%
if -1.85e-82 < y < 1e4Initial program 99.8%
associate-/l*99.8%
remove-double-neg99.8%
remove-double-neg99.8%
+-commutative99.8%
Simplified99.8%
sub-neg99.8%
associate-*r/99.8%
+-commutative99.8%
+-commutative99.8%
+-commutative99.8%
associate-*r/99.8%
distribute-lft-neg-in99.8%
add-cube-cbrt99.3%
associate-*r*99.3%
fma-define99.3%
pow299.3%
Applied egg-rr99.3%
Taylor expanded in y around 0 73.8%
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 10000.0) 1.0 x)))
double code(double x, double y) {
double tmp;
if (y <= -1.0) {
tmp = x;
} else if (y <= 10000.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 <= 10000.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 <= 10000.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.0: tmp = x elif y <= 10000.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y) tmp = 0.0 if (y <= -1.0) tmp = x; elseif (y <= 10000.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 <= 10000.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 10000.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 10000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1 or 1e4 < y Initial program 35.0%
associate-/l*57.5%
remove-double-neg57.5%
remove-double-neg57.5%
+-commutative57.5%
Simplified57.5%
Taylor expanded in y around inf 78.5%
if -1 < y < 1e4Initial program 99.8%
associate-/l*99.8%
remove-double-neg99.8%
remove-double-neg99.8%
+-commutative99.8%
Simplified99.8%
sub-neg99.8%
associate-*r/99.8%
+-commutative99.8%
+-commutative99.8%
+-commutative99.8%
associate-*r/99.8%
distribute-lft-neg-in99.8%
add-cube-cbrt99.1%
associate-*r*99.1%
fma-define99.2%
pow299.2%
Applied egg-rr99.2%
Taylor expanded in y around 0 67.8%
(FPCore (x y) :precision binary64 1.0)
double code(double x, double y) {
return 1.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0
end function
public static double code(double x, double y) {
return 1.0;
}
def code(x, y): return 1.0
function code(x, y) return 1.0 end
function tmp = code(x, y) tmp = 1.0; end
code[x_, y_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 68.4%
associate-/l*79.3%
remove-double-neg79.3%
remove-double-neg79.3%
+-commutative79.3%
Simplified79.3%
sub-neg79.3%
associate-*r/68.4%
+-commutative68.4%
+-commutative68.4%
+-commutative68.4%
associate-*r/79.3%
distribute-lft-neg-in79.3%
add-cube-cbrt78.9%
associate-*r*78.9%
fma-define79.0%
pow279.0%
Applied egg-rr79.0%
Taylor expanded in y around 0 36.7%
(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 2024181
(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))))