
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
(FPCore (x y) :precision binary64 (/ (/ (/ y (+ y x)) (+ 1.0 (/ (+ y 1.0) x))) (+ y x)))
double code(double x, double y) {
return ((y / (y + x)) / (1.0 + ((y + 1.0) / x))) / (y + x);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((y / (y + x)) / (1.0d0 + ((y + 1.0d0) / x))) / (y + x)
end function
public static double code(double x, double y) {
return ((y / (y + x)) / (1.0 + ((y + 1.0) / x))) / (y + x);
}
def code(x, y): return ((y / (y + x)) / (1.0 + ((y + 1.0) / x))) / (y + x)
function code(x, y) return Float64(Float64(Float64(y / Float64(y + x)) / Float64(1.0 + Float64(Float64(y + 1.0) / x))) / Float64(y + x)) end
function tmp = code(x, y) tmp = ((y / (y + x)) / (1.0 + ((y + 1.0) / x))) / (y + x); end
code[x_, y_] := N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(N[(y + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\frac{y}{y + x}}{1 + \frac{y + 1}{x}}}{y + x}
\end{array}
Initial program 70.1%
times-frac91.1%
+-commutative91.1%
+-commutative91.1%
+-commutative91.1%
times-frac70.1%
associate-*l/86.6%
*-commutative86.6%
*-commutative86.6%
distribute-rgt1-in68.8%
fma-def86.6%
+-commutative86.6%
+-commutative86.6%
cube-unmult86.6%
+-commutative86.6%
Simplified86.6%
associate-*r/70.1%
fma-udef57.1%
cube-mult57.1%
distribute-rgt1-in70.1%
associate-+r+70.1%
*-commutative70.1%
frac-times91.0%
associate-*l/84.5%
associate-/r*89.6%
div-inv89.5%
div-inv89.6%
associate-+r+89.6%
+-commutative89.6%
associate-+l+89.6%
Applied egg-rr89.6%
clear-num89.5%
un-div-inv89.5%
Applied egg-rr89.5%
Taylor expanded in y around 0 89.5%
+-commutative89.5%
Simplified89.5%
expm1-log1p-u89.5%
expm1-udef56.8%
associate-/l/56.8%
+-commutative56.8%
div-inv56.8%
*-un-lft-identity56.8%
distribute-rgt-out56.8%
Applied egg-rr56.8%
expm1-def99.4%
expm1-log1p99.4%
associate-/r*99.8%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (* (+ y x) (+ y x)))))
(if (<= y 1.65e-176)
(/ (/ y x) (+ x 1.0))
(if (<= y 6.8e-49)
(* t_0 (/ x (+ x 1.0)))
(if (<= y 1.82e+137)
(* t_0 (/ x (+ y 1.0)))
(/ (/ x (+ y x)) (+ y x)))))))
double code(double x, double y) {
double t_0 = y / ((y + x) * (y + x));
double tmp;
if (y <= 1.65e-176) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 6.8e-49) {
tmp = t_0 * (x / (x + 1.0));
} else if (y <= 1.82e+137) {
tmp = t_0 * (x / (y + 1.0));
} else {
tmp = (x / (y + x)) / (y + 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) :: tmp
t_0 = y / ((y + x) * (y + x))
if (y <= 1.65d-176) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 6.8d-49) then
tmp = t_0 * (x / (x + 1.0d0))
else if (y <= 1.82d+137) then
tmp = t_0 * (x / (y + 1.0d0))
else
tmp = (x / (y + x)) / (y + x)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y / ((y + x) * (y + x));
double tmp;
if (y <= 1.65e-176) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 6.8e-49) {
tmp = t_0 * (x / (x + 1.0));
} else if (y <= 1.82e+137) {
tmp = t_0 * (x / (y + 1.0));
} else {
tmp = (x / (y + x)) / (y + x);
}
return tmp;
}
def code(x, y): t_0 = y / ((y + x) * (y + x)) tmp = 0 if y <= 1.65e-176: tmp = (y / x) / (x + 1.0) elif y <= 6.8e-49: tmp = t_0 * (x / (x + 1.0)) elif y <= 1.82e+137: tmp = t_0 * (x / (y + 1.0)) else: tmp = (x / (y + x)) / (y + x) return tmp
function code(x, y) t_0 = Float64(y / Float64(Float64(y + x) * Float64(y + x))) tmp = 0.0 if (y <= 1.65e-176) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 6.8e-49) tmp = Float64(t_0 * Float64(x / Float64(x + 1.0))); elseif (y <= 1.82e+137) tmp = Float64(t_0 * Float64(x / Float64(y + 1.0))); else tmp = Float64(Float64(x / Float64(y + x)) / Float64(y + x)); end return tmp end
function tmp_2 = code(x, y) t_0 = y / ((y + x) * (y + x)); tmp = 0.0; if (y <= 1.65e-176) tmp = (y / x) / (x + 1.0); elseif (y <= 6.8e-49) tmp = t_0 * (x / (x + 1.0)); elseif (y <= 1.82e+137) tmp = t_0 * (x / (y + 1.0)); else tmp = (x / (y + x)) / (y + x); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.65e-176], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.8e-49], N[(t$95$0 * N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.82e+137], N[(t$95$0 * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{\left(y + x\right) \cdot \left(y + x\right)}\\
\mathbf{if}\;y \leq 1.65 \cdot 10^{-176}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{-49}:\\
\;\;\;\;t\_0 \cdot \frac{x}{x + 1}\\
\mathbf{elif}\;y \leq 1.82 \cdot 10^{+137}:\\
\;\;\;\;t\_0 \cdot \frac{x}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{y + x}\\
\end{array}
\end{array}
if y < 1.65000000000000006e-176Initial program 69.4%
associate-/r*70.7%
*-commutative70.7%
+-commutative70.7%
+-commutative70.7%
associate-*l/87.9%
+-commutative87.9%
associate-*r/87.9%
remove-double-neg87.9%
+-commutative87.9%
+-commutative87.9%
remove-double-neg87.9%
+-commutative87.9%
associate-+l+87.9%
Simplified87.9%
Taylor expanded in y around 0 50.9%
associate-/r*52.3%
+-commutative52.3%
Simplified52.3%
if 1.65000000000000006e-176 < y < 6.8000000000000001e-49Initial program 83.3%
associate-/r*87.3%
*-commutative87.3%
+-commutative87.3%
+-commutative87.3%
associate-*l/99.6%
+-commutative99.6%
associate-*r/99.6%
remove-double-neg99.6%
+-commutative99.6%
+-commutative99.6%
remove-double-neg99.6%
+-commutative99.6%
associate-+l+99.6%
Simplified99.6%
Taylor expanded in y around 0 99.6%
+-commutative99.6%
Simplified99.6%
if 6.8000000000000001e-49 < y < 1.81999999999999999e137Initial program 73.2%
associate-/r*83.2%
*-commutative83.2%
+-commutative83.2%
+-commutative83.2%
associate-*l/93.9%
+-commutative93.9%
associate-*r/94.0%
remove-double-neg94.0%
+-commutative94.0%
+-commutative94.0%
remove-double-neg94.0%
+-commutative94.0%
associate-+l+94.0%
Simplified94.0%
Taylor expanded in x around 0 83.5%
+-commutative83.5%
Simplified83.5%
if 1.81999999999999999e137 < y Initial program 60.3%
times-frac92.1%
+-commutative92.1%
+-commutative92.1%
+-commutative92.1%
times-frac60.3%
associate-*l/92.1%
*-commutative92.1%
*-commutative92.1%
distribute-rgt1-in89.7%
fma-def92.1%
+-commutative92.1%
+-commutative92.1%
cube-unmult92.1%
+-commutative92.1%
Simplified92.1%
associate-*r/60.3%
fma-udef60.3%
cube-mult60.3%
distribute-rgt1-in60.3%
associate-+r+60.3%
*-commutative60.3%
frac-times92.1%
associate-*l/92.1%
associate-/r*99.9%
div-inv100.0%
div-inv99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 87.5%
Final simplification69.4%
(FPCore (x y)
:precision binary64
(if (<= y 1.65e-176)
(/ (/ y x) (+ x 1.0))
(if (<= y 2.6e-17)
(* (/ y (* (+ y x) (+ y x))) (/ x (+ x 1.0)))
(/ (/ x (+ y 1.0)) (+ y x)))))
double code(double x, double y) {
double tmp;
if (y <= 1.65e-176) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 2.6e-17) {
tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0));
} else {
tmp = (x / (y + 1.0)) / (y + x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.65d-176) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 2.6d-17) then
tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0d0))
else
tmp = (x / (y + 1.0d0)) / (y + x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.65e-176) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 2.6e-17) {
tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0));
} else {
tmp = (x / (y + 1.0)) / (y + x);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.65e-176: tmp = (y / x) / (x + 1.0) elif y <= 2.6e-17: tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0)) else: tmp = (x / (y + 1.0)) / (y + x) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.65e-176) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 2.6e-17) tmp = Float64(Float64(y / Float64(Float64(y + x) * Float64(y + x))) * Float64(x / Float64(x + 1.0))); else tmp = Float64(Float64(x / Float64(y + 1.0)) / Float64(y + x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.65e-176) tmp = (y / x) / (x + 1.0); elseif (y <= 2.6e-17) tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0)); else tmp = (x / (y + 1.0)) / (y + x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.65e-176], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.6e-17], N[(N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.65 \cdot 10^{-176}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{-17}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\
\end{array}
\end{array}
if y < 1.65000000000000006e-176Initial program 69.4%
associate-/r*70.7%
*-commutative70.7%
+-commutative70.7%
+-commutative70.7%
associate-*l/87.9%
+-commutative87.9%
associate-*r/87.9%
remove-double-neg87.9%
+-commutative87.9%
+-commutative87.9%
remove-double-neg87.9%
+-commutative87.9%
associate-+l+87.9%
Simplified87.9%
Taylor expanded in y around 0 50.9%
associate-/r*52.3%
+-commutative52.3%
Simplified52.3%
if 1.65000000000000006e-176 < y < 2.60000000000000003e-17Initial program 87.1%
associate-/r*90.1%
*-commutative90.1%
+-commutative90.1%
+-commutative90.1%
associate-*l/99.6%
+-commutative99.6%
associate-*r/99.6%
remove-double-neg99.6%
+-commutative99.6%
+-commutative99.6%
remove-double-neg99.6%
+-commutative99.6%
associate-+l+99.6%
Simplified99.6%
Taylor expanded in y around 0 99.6%
+-commutative99.6%
Simplified99.6%
if 2.60000000000000003e-17 < y Initial program 63.5%
times-frac92.4%
+-commutative92.4%
+-commutative92.4%
+-commutative92.4%
times-frac63.5%
associate-*l/83.3%
*-commutative83.3%
*-commutative83.3%
distribute-rgt1-in78.0%
fma-def83.3%
+-commutative83.3%
+-commutative83.3%
cube-unmult83.3%
+-commutative83.3%
Simplified83.3%
associate-*r/63.5%
fma-udef62.0%
cube-mult62.0%
distribute-rgt1-in63.5%
associate-+r+63.5%
*-commutative63.5%
frac-times92.3%
associate-*l/92.3%
associate-/r*99.8%
div-inv99.8%
div-inv99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 74.4%
+-commutative74.4%
Simplified74.4%
Final simplification66.4%
(FPCore (x y)
:precision binary64
(if (<= y 2.6e-33)
(/ (* x (/ y (+ y x))) (* (+ y x) (+ x 1.0)))
(if (<= y 1.82e+137)
(* (/ y (* (+ y x) (+ y x))) (/ x (+ y 1.0)))
(/ (/ x (+ y x)) (+ y x)))))
double code(double x, double y) {
double tmp;
if (y <= 2.6e-33) {
tmp = (x * (y / (y + x))) / ((y + x) * (x + 1.0));
} else if (y <= 1.82e+137) {
tmp = (y / ((y + x) * (y + x))) * (x / (y + 1.0));
} else {
tmp = (x / (y + x)) / (y + x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.6d-33) then
tmp = (x * (y / (y + x))) / ((y + x) * (x + 1.0d0))
else if (y <= 1.82d+137) then
tmp = (y / ((y + x) * (y + x))) * (x / (y + 1.0d0))
else
tmp = (x / (y + x)) / (y + x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2.6e-33) {
tmp = (x * (y / (y + x))) / ((y + x) * (x + 1.0));
} else if (y <= 1.82e+137) {
tmp = (y / ((y + x) * (y + x))) * (x / (y + 1.0));
} else {
tmp = (x / (y + x)) / (y + x);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.6e-33: tmp = (x * (y / (y + x))) / ((y + x) * (x + 1.0)) elif y <= 1.82e+137: tmp = (y / ((y + x) * (y + x))) * (x / (y + 1.0)) else: tmp = (x / (y + x)) / (y + x) return tmp
function code(x, y) tmp = 0.0 if (y <= 2.6e-33) tmp = Float64(Float64(x * Float64(y / Float64(y + x))) / Float64(Float64(y + x) * Float64(x + 1.0))); elseif (y <= 1.82e+137) tmp = Float64(Float64(y / Float64(Float64(y + x) * Float64(y + x))) * Float64(x / Float64(y + 1.0))); else tmp = Float64(Float64(x / Float64(y + x)) / Float64(y + x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2.6e-33) tmp = (x * (y / (y + x))) / ((y + x) * (x + 1.0)); elseif (y <= 1.82e+137) tmp = (y / ((y + x) * (y + x))) * (x / (y + 1.0)); else tmp = (x / (y + x)) / (y + x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.6e-33], N[(N[(x * N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.82e+137], N[(N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.6 \cdot 10^{-33}:\\
\;\;\;\;\frac{x \cdot \frac{y}{y + x}}{\left(y + x\right) \cdot \left(x + 1\right)}\\
\mathbf{elif}\;y \leq 1.82 \cdot 10^{+137}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{y + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{y + x}\\
\end{array}
\end{array}
if y < 2.59999999999999994e-33Initial program 72.8%
associate-/r*74.5%
*-commutative74.5%
+-commutative74.5%
+-commutative74.5%
associate-*l/90.3%
+-commutative90.3%
associate-*r/90.3%
remove-double-neg90.3%
+-commutative90.3%
+-commutative90.3%
remove-double-neg90.3%
+-commutative90.3%
associate-+l+90.3%
Simplified90.3%
Taylor expanded in y around 0 82.9%
+-commutative82.9%
Simplified82.9%
associate-/r*84.0%
frac-times85.1%
+-commutative85.1%
+-commutative85.1%
Applied egg-rr85.1%
if 2.59999999999999994e-33 < y < 1.81999999999999999e137Initial program 69.5%
associate-/r*80.9%
*-commutative80.9%
+-commutative80.9%
+-commutative80.9%
associate-*l/93.2%
+-commutative93.2%
associate-*r/93.2%
remove-double-neg93.2%
+-commutative93.2%
+-commutative93.2%
remove-double-neg93.2%
+-commutative93.2%
associate-+l+93.2%
Simplified93.2%
Taylor expanded in x around 0 83.9%
+-commutative83.9%
Simplified83.9%
if 1.81999999999999999e137 < y Initial program 60.3%
times-frac92.1%
+-commutative92.1%
+-commutative92.1%
+-commutative92.1%
times-frac60.3%
associate-*l/92.1%
*-commutative92.1%
*-commutative92.1%
distribute-rgt1-in89.7%
fma-def92.1%
+-commutative92.1%
+-commutative92.1%
cube-unmult92.1%
+-commutative92.1%
Simplified92.1%
associate-*r/60.3%
fma-udef60.3%
cube-mult60.3%
distribute-rgt1-in60.3%
associate-+r+60.3%
*-commutative60.3%
frac-times92.1%
associate-*l/92.1%
associate-/r*99.9%
div-inv100.0%
div-inv99.9%
associate-+r+99.9%
+-commutative99.9%
associate-+l+99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 87.5%
Final simplification85.3%
(FPCore (x y) :precision binary64 (if (<= x -1.45e-15) (* (/ y (* (+ y x) (+ y x))) (/ x (+ x (+ y 1.0)))) (/ (* x (/ y (+ y x))) (* (+ y 1.0) (+ y x)))))
double code(double x, double y) {
double tmp;
if (x <= -1.45e-15) {
tmp = (y / ((y + x) * (y + x))) * (x / (x + (y + 1.0)));
} else {
tmp = (x * (y / (y + x))) / ((y + 1.0) * (y + x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.45d-15)) then
tmp = (y / ((y + x) * (y + x))) * (x / (x + (y + 1.0d0)))
else
tmp = (x * (y / (y + x))) / ((y + 1.0d0) * (y + x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.45e-15) {
tmp = (y / ((y + x) * (y + x))) * (x / (x + (y + 1.0)));
} else {
tmp = (x * (y / (y + x))) / ((y + 1.0) * (y + x));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.45e-15: tmp = (y / ((y + x) * (y + x))) * (x / (x + (y + 1.0))) else: tmp = (x * (y / (y + x))) / ((y + 1.0) * (y + x)) return tmp
function code(x, y) tmp = 0.0 if (x <= -1.45e-15) tmp = Float64(Float64(y / Float64(Float64(y + x) * Float64(y + x))) * Float64(x / Float64(x + Float64(y + 1.0)))); else tmp = Float64(Float64(x * Float64(y / Float64(y + x))) / Float64(Float64(y + 1.0) * Float64(y + x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.45e-15) tmp = (y / ((y + x) * (y + x))) * (x / (x + (y + 1.0))); else tmp = (x * (y / (y + x))) / ((y + 1.0) * (y + x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.45e-15], N[(N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(y + 1.0), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{-15}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{x + \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{y}{y + x}}{\left(y + 1\right) \cdot \left(y + x\right)}\\
\end{array}
\end{array}
if x < -1.45000000000000009e-15Initial program 57.7%
associate-/r*64.7%
*-commutative64.7%
+-commutative64.7%
+-commutative64.7%
associate-*l/86.6%
+-commutative86.6%
associate-*r/86.5%
remove-double-neg86.5%
+-commutative86.5%
+-commutative86.5%
remove-double-neg86.5%
+-commutative86.5%
associate-+l+86.5%
Simplified86.5%
if -1.45000000000000009e-15 < x Initial program 73.6%
associate-/r*75.4%
*-commutative75.4%
+-commutative75.4%
+-commutative75.4%
associate-*l/92.3%
+-commutative92.3%
associate-*r/92.3%
remove-double-neg92.3%
+-commutative92.3%
+-commutative92.3%
remove-double-neg92.3%
+-commutative92.3%
associate-+l+92.3%
Simplified92.3%
Taylor expanded in x around 0 86.5%
+-commutative86.5%
Simplified86.5%
associate-/r*91.6%
frac-times87.7%
+-commutative87.7%
+-commutative87.7%
Applied egg-rr87.7%
Final simplification87.4%
(FPCore (x y) :precision binary64 (if (<= x -2.1e-15) (/ (/ (* y (/ x (+ y (+ x 1.0)))) (+ y x)) (+ y x)) (/ (* x (/ y (+ y x))) (* (+ y 1.0) (+ y x)))))
double code(double x, double y) {
double tmp;
if (x <= -2.1e-15) {
tmp = ((y * (x / (y + (x + 1.0)))) / (y + x)) / (y + x);
} else {
tmp = (x * (y / (y + x))) / ((y + 1.0) * (y + x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-2.1d-15)) then
tmp = ((y * (x / (y + (x + 1.0d0)))) / (y + x)) / (y + x)
else
tmp = (x * (y / (y + x))) / ((y + 1.0d0) * (y + x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -2.1e-15) {
tmp = ((y * (x / (y + (x + 1.0)))) / (y + x)) / (y + x);
} else {
tmp = (x * (y / (y + x))) / ((y + 1.0) * (y + x));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -2.1e-15: tmp = ((y * (x / (y + (x + 1.0)))) / (y + x)) / (y + x) else: tmp = (x * (y / (y + x))) / ((y + 1.0) * (y + x)) return tmp
function code(x, y) tmp = 0.0 if (x <= -2.1e-15) tmp = Float64(Float64(Float64(y * Float64(x / Float64(y + Float64(x + 1.0)))) / Float64(y + x)) / Float64(y + x)); else tmp = Float64(Float64(x * Float64(y / Float64(y + x))) / Float64(Float64(y + 1.0) * Float64(y + x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -2.1e-15) tmp = ((y * (x / (y + (x + 1.0)))) / (y + x)) / (y + x); else tmp = (x * (y / (y + x))) / ((y + 1.0) * (y + x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -2.1e-15], N[(N[(N[(y * N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(y + 1.0), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{-15}:\\
\;\;\;\;\frac{\frac{y \cdot \frac{x}{y + \left(x + 1\right)}}{y + x}}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{y}{y + x}}{\left(y + 1\right) \cdot \left(y + x\right)}\\
\end{array}
\end{array}
if x < -2.09999999999999981e-15Initial program 57.7%
times-frac86.6%
+-commutative86.6%
+-commutative86.6%
+-commutative86.6%
times-frac57.7%
associate-*l/79.4%
*-commutative79.4%
*-commutative79.4%
distribute-rgt1-in40.8%
fma-def79.4%
+-commutative79.4%
+-commutative79.4%
cube-unmult79.3%
+-commutative79.3%
Simplified79.3%
associate-*r/57.6%
fma-udef32.1%
cube-mult32.1%
distribute-rgt1-in57.7%
associate-+r+57.7%
*-commutative57.7%
frac-times86.5%
associate-*l/86.6%
associate-/r*99.8%
div-inv99.6%
div-inv99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
if -2.09999999999999981e-15 < x Initial program 73.6%
associate-/r*75.4%
*-commutative75.4%
+-commutative75.4%
+-commutative75.4%
associate-*l/92.3%
+-commutative92.3%
associate-*r/92.3%
remove-double-neg92.3%
+-commutative92.3%
+-commutative92.3%
remove-double-neg92.3%
+-commutative92.3%
associate-+l+92.3%
Simplified92.3%
Taylor expanded in x around 0 86.5%
+-commutative86.5%
Simplified86.5%
associate-/r*91.6%
frac-times87.7%
+-commutative87.7%
+-commutative87.7%
Applied egg-rr87.7%
Final simplification90.3%
(FPCore (x y) :precision binary64 (if (<= x -3e-15) (* (/ y (* (+ y x) (+ y x))) (/ x (+ x 1.0))) (/ (* x (/ y (+ y x))) (* (+ y 1.0) (+ y x)))))
double code(double x, double y) {
double tmp;
if (x <= -3e-15) {
tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0));
} else {
tmp = (x * (y / (y + x))) / ((y + 1.0) * (y + x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-3d-15)) then
tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0d0))
else
tmp = (x * (y / (y + x))) / ((y + 1.0d0) * (y + x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -3e-15) {
tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0));
} else {
tmp = (x * (y / (y + x))) / ((y + 1.0) * (y + x));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -3e-15: tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0)) else: tmp = (x * (y / (y + x))) / ((y + 1.0) * (y + x)) return tmp
function code(x, y) tmp = 0.0 if (x <= -3e-15) tmp = Float64(Float64(y / Float64(Float64(y + x) * Float64(y + x))) * Float64(x / Float64(x + 1.0))); else tmp = Float64(Float64(x * Float64(y / Float64(y + x))) / Float64(Float64(y + 1.0) * Float64(y + x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -3e-15) tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0)); else tmp = (x * (y / (y + x))) / ((y + 1.0) * (y + x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -3e-15], N[(N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(y + 1.0), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{-15}:\\
\;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{y}{y + x}}{\left(y + 1\right) \cdot \left(y + x\right)}\\
\end{array}
\end{array}
if x < -3e-15Initial program 57.7%
associate-/r*64.7%
*-commutative64.7%
+-commutative64.7%
+-commutative64.7%
associate-*l/86.6%
+-commutative86.6%
associate-*r/86.5%
remove-double-neg86.5%
+-commutative86.5%
+-commutative86.5%
remove-double-neg86.5%
+-commutative86.5%
associate-+l+86.5%
Simplified86.5%
Taylor expanded in y around 0 81.5%
+-commutative81.5%
Simplified81.5%
if -3e-15 < x Initial program 73.6%
associate-/r*75.4%
*-commutative75.4%
+-commutative75.4%
+-commutative75.4%
associate-*l/92.3%
+-commutative92.3%
associate-*r/92.3%
remove-double-neg92.3%
+-commutative92.3%
+-commutative92.3%
remove-double-neg92.3%
+-commutative92.3%
associate-+l+92.3%
Simplified92.3%
Taylor expanded in x around 0 86.5%
+-commutative86.5%
Simplified86.5%
associate-/r*91.6%
frac-times87.7%
+-commutative87.7%
+-commutative87.7%
Applied egg-rr87.7%
Final simplification86.3%
(FPCore (x y) :precision binary64 (if (<= x -4.3e-53) (/ (/ y x) (+ x 1.0)) (/ (/ x (+ y 1.0)) (+ y x))))
double code(double x, double y) {
double tmp;
if (x <= -4.3e-53) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (y + 1.0)) / (y + x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-4.3d-53)) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / (y + 1.0d0)) / (y + x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -4.3e-53) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (y + 1.0)) / (y + x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -4.3e-53: tmp = (y / x) / (x + 1.0) else: tmp = (x / (y + 1.0)) / (y + x) return tmp
function code(x, y) tmp = 0.0 if (x <= -4.3e-53) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / Float64(y + 1.0)) / Float64(y + x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -4.3e-53) tmp = (y / x) / (x + 1.0); else tmp = (x / (y + 1.0)) / (y + x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -4.3e-53], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.3 \cdot 10^{-53}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\
\end{array}
\end{array}
if x < -4.3e-53Initial program 61.5%
associate-/r*67.7%
*-commutative67.7%
+-commutative67.7%
+-commutative67.7%
associate-*l/88.2%
+-commutative88.2%
associate-*r/88.2%
remove-double-neg88.2%
+-commutative88.2%
+-commutative88.2%
remove-double-neg88.2%
+-commutative88.2%
associate-+l+88.2%
Simplified88.2%
Taylor expanded in y around 0 69.9%
associate-/r*69.2%
+-commutative69.2%
Simplified69.2%
if -4.3e-53 < x Initial program 73.0%
times-frac92.0%
+-commutative92.0%
+-commutative92.0%
+-commutative92.0%
times-frac73.0%
associate-*l/88.1%
*-commutative88.1%
*-commutative88.1%
distribute-rgt1-in76.2%
fma-def88.1%
+-commutative88.1%
+-commutative88.1%
cube-unmult88.1%
+-commutative88.1%
Simplified88.1%
associate-*r/73.0%
fma-udef63.6%
cube-mult63.6%
distribute-rgt1-in73.0%
associate-+r+73.0%
*-commutative73.0%
frac-times92.0%
associate-*l/83.8%
associate-/r*86.7%
div-inv86.6%
div-inv86.7%
associate-+r+86.7%
+-commutative86.7%
associate-+l+86.7%
Applied egg-rr86.7%
Taylor expanded in x around 0 63.3%
+-commutative63.3%
Simplified63.3%
Final simplification64.8%
(FPCore (x y) :precision binary64 (if (<= y 1.09e-187) (- (/ y x) y) (/ x (* y (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= 1.09e-187) {
tmp = (y / x) - y;
} else {
tmp = 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) :: tmp
if (y <= 1.09d-187) then
tmp = (y / x) - y
else
tmp = x / (y * (y + 1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.09e-187) {
tmp = (y / x) - y;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.09e-187: tmp = (y / x) - y else: tmp = x / (y * (y + 1.0)) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.09e-187) tmp = Float64(Float64(y / x) - y); else tmp = Float64(x / Float64(y * Float64(y + 1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.09e-187) tmp = (y / x) - y; else tmp = x / (y * (y + 1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.09e-187], N[(N[(y / x), $MachinePrecision] - y), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.09 \cdot 10^{-187}:\\
\;\;\;\;\frac{y}{x} - y\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 1.08999999999999997e-187Initial program 69.4%
associate-/r*70.7%
*-commutative70.7%
+-commutative70.7%
+-commutative70.7%
associate-*l/88.3%
+-commutative88.3%
associate-*r/88.3%
remove-double-neg88.3%
+-commutative88.3%
+-commutative88.3%
remove-double-neg88.3%
+-commutative88.3%
associate-+l+88.3%
Simplified88.3%
Taylor expanded in y around 0 50.5%
associate-/r*51.9%
+-commutative51.9%
Simplified51.9%
Taylor expanded in x around 0 21.8%
neg-mul-121.8%
+-commutative21.8%
unsub-neg21.8%
Simplified21.8%
if 1.08999999999999997e-187 < y Initial program 70.8%
associate-/r*75.6%
*-commutative75.6%
+-commutative75.6%
+-commutative75.6%
associate-*l/94.0%
+-commutative94.0%
associate-*r/94.0%
remove-double-neg94.0%
+-commutative94.0%
+-commutative94.0%
remove-double-neg94.0%
+-commutative94.0%
associate-+l+94.0%
Simplified94.0%
Taylor expanded in x around 0 63.0%
+-commutative63.0%
Simplified63.0%
Final simplification41.6%
(FPCore (x y) :precision binary64 (if (<= x -1.55e-50) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if (x <= -1.55e-50) {
tmp = y / (x * (x + 1.0));
} else {
tmp = 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) :: tmp
if (x <= (-1.55d-50)) then
tmp = y / (x * (x + 1.0d0))
else
tmp = x / (y * (y + 1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.55e-50) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.55e-50: tmp = y / (x * (x + 1.0)) else: tmp = x / (y * (y + 1.0)) return tmp
function code(x, y) tmp = 0.0 if (x <= -1.55e-50) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(x / Float64(y * Float64(y + 1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.55e-50) tmp = y / (x * (x + 1.0)); else tmp = x / (y * (y + 1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.55e-50], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{-50}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -1.5500000000000001e-50Initial program 61.5%
associate-/r*67.7%
*-commutative67.7%
+-commutative67.7%
+-commutative67.7%
associate-*l/88.2%
+-commutative88.2%
associate-*r/88.2%
remove-double-neg88.2%
+-commutative88.2%
+-commutative88.2%
remove-double-neg88.2%
+-commutative88.2%
associate-+l+88.2%
Simplified88.2%
Taylor expanded in y around 0 69.9%
if -1.5500000000000001e-50 < x Initial program 73.0%
associate-/r*74.9%
*-commutative74.9%
+-commutative74.9%
+-commutative74.9%
associate-*l/92.0%
+-commutative92.0%
associate-*r/92.0%
remove-double-neg92.0%
+-commutative92.0%
+-commutative92.0%
remove-double-neg92.0%
+-commutative92.0%
associate-+l+92.0%
Simplified92.0%
Taylor expanded in x around 0 65.2%
+-commutative65.2%
Simplified65.2%
Final simplification66.4%
(FPCore (x y) :precision binary64 (if (<= x -1.26e-50) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
double code(double x, double y) {
double tmp;
if (x <= -1.26e-50) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (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) :: tmp
if (x <= (-1.26d-50)) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.26e-50) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.26e-50: tmp = y / (x * (x + 1.0)) else: tmp = (x / y) / (y + 1.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -1.26e-50) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.26e-50) tmp = y / (x * (x + 1.0)); else tmp = (x / y) / (y + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.26e-50], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.26 \cdot 10^{-50}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.26e-50Initial program 61.5%
associate-/r*67.7%
*-commutative67.7%
+-commutative67.7%
+-commutative67.7%
associate-*l/88.2%
+-commutative88.2%
associate-*r/88.2%
remove-double-neg88.2%
+-commutative88.2%
+-commutative88.2%
remove-double-neg88.2%
+-commutative88.2%
associate-+l+88.2%
Simplified88.2%
Taylor expanded in y around 0 69.9%
if -1.26e-50 < x Initial program 73.0%
times-frac92.0%
+-commutative92.0%
+-commutative92.0%
+-commutative92.0%
times-frac73.0%
associate-*l/88.1%
*-commutative88.1%
*-commutative88.1%
distribute-rgt1-in76.2%
fma-def88.1%
+-commutative88.1%
+-commutative88.1%
cube-unmult88.1%
+-commutative88.1%
Simplified88.1%
associate-*r/73.0%
fma-udef63.6%
cube-mult63.6%
distribute-rgt1-in73.0%
associate-+r+73.0%
*-commutative73.0%
frac-times92.0%
associate-*l/83.8%
associate-/r*86.7%
div-inv86.6%
div-inv86.7%
associate-+r+86.7%
+-commutative86.7%
associate-+l+86.7%
Applied egg-rr86.7%
Taylor expanded in x around 0 65.2%
associate-/r*63.0%
+-commutative63.0%
Simplified63.0%
Final simplification64.7%
(FPCore (x y) :precision binary64 (if (<= x -6.7e-52) (/ y (* x (+ x 1.0))) (/ (/ x (+ y 1.0)) y)))
double code(double x, double y) {
double tmp;
if (x <= -6.7e-52) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-6.7d-52)) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / (y + 1.0d0)) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -6.7e-52) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -6.7e-52: tmp = y / (x * (x + 1.0)) else: tmp = (x / (y + 1.0)) / y return tmp
function code(x, y) tmp = 0.0 if (x <= -6.7e-52) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / Float64(y + 1.0)) / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -6.7e-52) tmp = y / (x * (x + 1.0)); else tmp = (x / (y + 1.0)) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -6.7e-52], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.7 \cdot 10^{-52}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if x < -6.6999999999999998e-52Initial program 61.5%
associate-/r*67.7%
*-commutative67.7%
+-commutative67.7%
+-commutative67.7%
associate-*l/88.2%
+-commutative88.2%
associate-*r/88.2%
remove-double-neg88.2%
+-commutative88.2%
+-commutative88.2%
remove-double-neg88.2%
+-commutative88.2%
associate-+l+88.2%
Simplified88.2%
Taylor expanded in y around 0 69.9%
if -6.6999999999999998e-52 < x Initial program 73.0%
associate-/r*74.9%
*-commutative74.9%
+-commutative74.9%
+-commutative74.9%
associate-*l/92.0%
+-commutative92.0%
associate-*r/92.0%
remove-double-neg92.0%
+-commutative92.0%
+-commutative92.0%
remove-double-neg92.0%
+-commutative92.0%
associate-+l+92.0%
Simplified92.0%
Taylor expanded in x around 0 65.2%
+-commutative65.2%
Simplified65.2%
*-un-lft-identity65.2%
times-frac63.0%
Applied egg-rr63.0%
associate-*l/63.0%
+-commutative63.0%
*-lft-identity63.0%
+-commutative63.0%
Simplified63.0%
Final simplification64.7%
(FPCore (x y) :precision binary64 (if (<= x -1.52e-50) (/ (/ y x) (+ x 1.0)) (/ (/ x (+ y 1.0)) y)))
double code(double x, double y) {
double tmp;
if (x <= -1.52e-50) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.52d-50)) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / (y + 1.0d0)) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.52e-50) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (y + 1.0)) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.52e-50: tmp = (y / x) / (x + 1.0) else: tmp = (x / (y + 1.0)) / y return tmp
function code(x, y) tmp = 0.0 if (x <= -1.52e-50) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / Float64(y + 1.0)) / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.52e-50) tmp = (y / x) / (x + 1.0); else tmp = (x / (y + 1.0)) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.52e-50], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.52 \cdot 10^{-50}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\
\end{array}
\end{array}
if x < -1.52000000000000001e-50Initial program 61.5%
associate-/r*67.7%
*-commutative67.7%
+-commutative67.7%
+-commutative67.7%
associate-*l/88.2%
+-commutative88.2%
associate-*r/88.2%
remove-double-neg88.2%
+-commutative88.2%
+-commutative88.2%
remove-double-neg88.2%
+-commutative88.2%
associate-+l+88.2%
Simplified88.2%
Taylor expanded in y around 0 69.9%
associate-/r*69.2%
+-commutative69.2%
Simplified69.2%
if -1.52000000000000001e-50 < x Initial program 73.0%
associate-/r*74.9%
*-commutative74.9%
+-commutative74.9%
+-commutative74.9%
associate-*l/92.0%
+-commutative92.0%
associate-*r/92.0%
remove-double-neg92.0%
+-commutative92.0%
+-commutative92.0%
remove-double-neg92.0%
+-commutative92.0%
associate-+l+92.0%
Simplified92.0%
Taylor expanded in x around 0 65.2%
+-commutative65.2%
Simplified65.2%
*-un-lft-identity65.2%
times-frac63.0%
Applied egg-rr63.0%
associate-*l/63.0%
+-commutative63.0%
*-lft-identity63.0%
+-commutative63.0%
Simplified63.0%
Final simplification64.6%
(FPCore (x y) :precision binary64 (if (<= x -1.55e-169) (- (/ y x) y) (- (/ x y) x)))
double code(double x, double y) {
double tmp;
if (x <= -1.55e-169) {
tmp = (y / x) - y;
} else {
tmp = (x / y) - x;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.55d-169)) then
tmp = (y / x) - y
else
tmp = (x / y) - x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.55e-169) {
tmp = (y / x) - y;
} else {
tmp = (x / y) - x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.55e-169: tmp = (y / x) - y else: tmp = (x / y) - x return tmp
function code(x, y) tmp = 0.0 if (x <= -1.55e-169) tmp = Float64(Float64(y / x) - y); else tmp = Float64(Float64(x / y) - x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.55e-169) tmp = (y / x) - y; else tmp = (x / y) - x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.55e-169], N[(N[(y / x), $MachinePrecision] - y), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{-169}:\\
\;\;\;\;\frac{y}{x} - y\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - x\\
\end{array}
\end{array}
if x < -1.5500000000000001e-169Initial program 65.2%
associate-/r*70.1%
*-commutative70.1%
+-commutative70.1%
+-commutative70.1%
associate-*l/90.7%
+-commutative90.7%
associate-*r/90.7%
remove-double-neg90.7%
+-commutative90.7%
+-commutative90.7%
remove-double-neg90.7%
+-commutative90.7%
associate-+l+90.7%
Simplified90.7%
Taylor expanded in y around 0 61.1%
associate-/r*60.6%
+-commutative60.6%
Simplified60.6%
Taylor expanded in x around 0 16.4%
neg-mul-116.4%
+-commutative16.4%
unsub-neg16.4%
Simplified16.4%
if -1.5500000000000001e-169 < x Initial program 72.4%
associate-/r*74.5%
*-commutative74.5%
+-commutative74.5%
+-commutative74.5%
associate-*l/91.2%
+-commutative91.2%
associate-*r/91.2%
remove-double-neg91.2%
+-commutative91.2%
+-commutative91.2%
remove-double-neg91.2%
+-commutative91.2%
associate-+l+91.2%
Simplified91.2%
Taylor expanded in x around 0 64.6%
+-commutative64.6%
Simplified64.6%
Taylor expanded in y around 0 19.1%
neg-mul-119.1%
+-commutative19.1%
unsub-neg19.1%
Simplified19.1%
Final simplification18.3%
(FPCore (x y) :precision binary64 (- (/ x y) x))
double code(double x, double y) {
return (x / y) - x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x / y) - x
end function
public static double code(double x, double y) {
return (x / y) - x;
}
def code(x, y): return (x / y) - x
function code(x, y) return Float64(Float64(x / y) - x) end
function tmp = code(x, y) tmp = (x / y) - x; end
code[x_, y_] := N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} - x
\end{array}
Initial program 70.1%
associate-/r*73.1%
*-commutative73.1%
+-commutative73.1%
+-commutative73.1%
associate-*l/91.0%
+-commutative91.0%
associate-*r/91.0%
remove-double-neg91.0%
+-commutative91.0%
+-commutative91.0%
remove-double-neg91.0%
+-commutative91.0%
associate-+l+91.0%
Simplified91.0%
Taylor expanded in x around 0 56.6%
+-commutative56.6%
Simplified56.6%
Taylor expanded in y around 0 14.8%
neg-mul-114.8%
+-commutative14.8%
unsub-neg14.8%
Simplified14.8%
Final simplification14.8%
(FPCore (x y) :precision binary64 (/ 1.0 y))
double code(double x, double y) {
return 1.0 / y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 / y
end function
public static double code(double x, double y) {
return 1.0 / y;
}
def code(x, y): return 1.0 / y
function code(x, y) return Float64(1.0 / y) end
function tmp = code(x, y) tmp = 1.0 / y; end
code[x_, y_] := N[(1.0 / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{y}
\end{array}
Initial program 70.1%
times-frac91.1%
+-commutative91.1%
+-commutative91.1%
+-commutative91.1%
times-frac70.1%
associate-*l/86.6%
*-commutative86.6%
*-commutative86.6%
distribute-rgt1-in68.8%
fma-def86.6%
+-commutative86.6%
+-commutative86.6%
cube-unmult86.6%
+-commutative86.6%
Simplified86.6%
associate-*r/70.1%
fma-udef57.1%
cube-mult57.1%
distribute-rgt1-in70.1%
associate-+r+70.1%
*-commutative70.1%
frac-times91.0%
associate-*l/84.5%
associate-/r*89.6%
div-inv89.5%
div-inv89.6%
associate-+r+89.6%
+-commutative89.6%
associate-+l+89.6%
Applied egg-rr89.6%
Taylor expanded in y around inf 43.5%
Taylor expanded in x around inf 4.7%
Final simplification4.7%
(FPCore (x y) :precision binary64 (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x)))))
double code(double x, double y) {
return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x / ((y + 1.0d0) + x)) / (y + x)) / (1.0d0 / (y / (y + x)))
end function
public static double code(double x, double y) {
return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
def code(x, y): return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)))
function code(x, y) return Float64(Float64(Float64(x / Float64(Float64(y + 1.0) + x)) / Float64(y + x)) / Float64(1.0 / Float64(y / Float64(y + x)))) end
function tmp = code(x, y) tmp = ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x))); end
code[x_, y_] := N[(N[(N[(x / N[(N[(y + 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}}
\end{array}
herbie shell --seed 2024027
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
:precision binary64
:herbie-target
(/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))