
(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 18 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 (* (/ x (+ x y)) (/ (/ y (+ x y)) (+ x (+ y 1.0)))))
double code(double x, double y) {
return (x / (x + y)) * ((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 / (x + y)) * ((y / (x + y)) / (x + (y + 1.0d0)))
end function
public static double code(double x, double y) {
return (x / (x + y)) * ((y / (x + y)) / (x + (y + 1.0)));
}
def code(x, y): return (x / (x + y)) * ((y / (x + y)) / (x + (y + 1.0)))
function code(x, y) return Float64(Float64(x / Float64(x + y)) * Float64(Float64(y / Float64(x + y)) / Float64(x + Float64(y + 1.0)))) end
function tmp = code(x, y) tmp = (x / (x + y)) * ((y / (x + y)) / (x + (y + 1.0))); end
code[x_, y_] := N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{x + y} \cdot \frac{\frac{y}{x + y}}{x + \left(y + 1\right)}
\end{array}
Initial program 71.9%
+-commutative71.9%
+-commutative71.9%
+-commutative71.9%
*-commutative71.9%
distribute-rgt1-in52.7%
fma-define71.9%
+-commutative71.9%
+-commutative71.9%
cube-unmult71.9%
+-commutative71.9%
Simplified71.9%
fma-define52.7%
cube-mult52.7%
distribute-rgt1-in71.9%
*-commutative71.9%
associate-*l*71.9%
times-frac93.3%
associate-+r+93.3%
Applied egg-rr93.3%
div-inv93.2%
Applied egg-rr93.2%
associate-*r/93.3%
*-rgt-identity93.3%
associate-/r*99.8%
Simplified99.8%
(FPCore (x y)
:precision binary64
(if (<= y 3.8e-165)
(/ (/ y x) (+ x 1.0))
(if (<= y 4.1e-11)
(* x (/ y (* (+ x 1.0) (* (+ x y) (+ x y)))))
(if (<= y 5e+158)
(* (/ x y) (/ y (* (+ x y) (+ x (+ y 1.0)))))
(/ (/ x (+ x y)) (+ y 1.0))))))
double code(double x, double y) {
double tmp;
if (y <= 3.8e-165) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 4.1e-11) {
tmp = x * (y / ((x + 1.0) * ((x + y) * (x + y))));
} else if (y <= 5e+158) {
tmp = (x / y) * (y / ((x + y) * (x + (y + 1.0))));
} else {
tmp = (x / (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 <= 3.8d-165) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 4.1d-11) then
tmp = x * (y / ((x + 1.0d0) * ((x + y) * (x + y))))
else if (y <= 5d+158) then
tmp = (x / y) * (y / ((x + y) * (x + (y + 1.0d0))))
else
tmp = (x / (x + y)) / (y + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 3.8e-165) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 4.1e-11) {
tmp = x * (y / ((x + 1.0) * ((x + y) * (x + y))));
} else if (y <= 5e+158) {
tmp = (x / y) * (y / ((x + y) * (x + (y + 1.0))));
} else {
tmp = (x / (x + y)) / (y + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 3.8e-165: tmp = (y / x) / (x + 1.0) elif y <= 4.1e-11: tmp = x * (y / ((x + 1.0) * ((x + y) * (x + y)))) elif y <= 5e+158: tmp = (x / y) * (y / ((x + y) * (x + (y + 1.0)))) else: tmp = (x / (x + y)) / (y + 1.0) return tmp
function code(x, y) tmp = 0.0 if (y <= 3.8e-165) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 4.1e-11) tmp = Float64(x * Float64(y / Float64(Float64(x + 1.0) * Float64(Float64(x + y) * Float64(x + y))))); elseif (y <= 5e+158) tmp = Float64(Float64(x / y) * Float64(y / Float64(Float64(x + y) * Float64(x + Float64(y + 1.0))))); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(y + 1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 3.8e-165) tmp = (y / x) / (x + 1.0); elseif (y <= 4.1e-11) tmp = x * (y / ((x + 1.0) * ((x + y) * (x + y)))); elseif (y <= 5e+158) tmp = (x / y) * (y / ((x + y) * (x + (y + 1.0)))); else tmp = (x / (x + y)) / (y + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 3.8e-165], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.1e-11], N[(x * N[(y / N[(N[(x + 1.0), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e+158], N[(N[(x / y), $MachinePrecision] * N[(y / N[(N[(x + y), $MachinePrecision] * N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.8 \cdot 10^{-165}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{-11}:\\
\;\;\;\;x \cdot \frac{y}{\left(x + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+158}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{y}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\
\end{array}
\end{array}
if y < 3.80000000000000018e-165Initial program 75.5%
+-commutative75.5%
+-commutative75.5%
+-commutative75.5%
*-commutative75.5%
distribute-rgt1-in49.8%
fma-define75.4%
+-commutative75.4%
+-commutative75.4%
cube-unmult75.5%
+-commutative75.5%
Simplified75.5%
fma-define49.8%
cube-mult49.8%
distribute-rgt1-in75.5%
*-commutative75.5%
associate-*l*75.4%
times-frac94.7%
associate-+r+94.7%
Applied egg-rr94.7%
Taylor expanded in y around 0 56.0%
associate-/r*57.1%
+-commutative57.1%
Simplified57.1%
if 3.80000000000000018e-165 < y < 4.1000000000000001e-11Initial program 88.8%
associate-/l*88.4%
associate-+l+88.4%
Simplified88.4%
Taylor expanded in y around 0 88.4%
+-commutative99.9%
Simplified88.4%
if 4.1000000000000001e-11 < y < 4.9999999999999996e158Initial program 62.2%
+-commutative62.2%
+-commutative62.2%
+-commutative62.2%
*-commutative62.2%
distribute-rgt1-in56.8%
fma-define62.2%
+-commutative62.2%
+-commutative62.2%
cube-unmult62.2%
+-commutative62.2%
Simplified62.2%
fma-define56.8%
cube-mult56.8%
distribute-rgt1-in62.2%
*-commutative62.2%
associate-*l*62.2%
times-frac92.2%
associate-+r+92.2%
Applied egg-rr92.2%
Taylor expanded in x around 0 89.7%
if 4.9999999999999996e158 < y Initial program 55.9%
+-commutative55.9%
+-commutative55.9%
+-commutative55.9%
*-commutative55.9%
distribute-rgt1-in55.9%
fma-define55.9%
+-commutative55.9%
+-commutative55.9%
cube-unmult55.9%
+-commutative55.9%
Simplified55.9%
fma-define55.9%
cube-mult55.9%
distribute-rgt1-in55.9%
*-commutative55.9%
associate-*l*55.9%
times-frac84.4%
associate-+r+84.4%
Applied egg-rr84.4%
div-inv84.4%
Applied egg-rr84.4%
associate-*r/84.4%
*-rgt-identity84.4%
associate-/r*99.8%
Simplified99.8%
div-inv99.8%
*-inverses99.8%
associate-/r*84.4%
clear-num84.4%
un-div-inv84.4%
*-inverses84.4%
div-inv84.4%
+-commutative84.4%
associate-/l*100.0%
+-commutative100.0%
associate-+r+100.0%
+-commutative100.0%
associate-+l+100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 89.8%
+-commutative89.8%
Simplified89.8%
Final simplification69.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ x (+ y 1.0))))
(if (<= y 9e-11)
(* (/ x (+ x y)) (/ (/ y (+ x y)) (+ x 1.0)))
(if (<= y 3.4e+160)
(* (/ x y) (/ y (* (+ x y) t_0)))
(/ (* x (/ (- 1.0 (/ x y)) y)) t_0)))))
double code(double x, double y) {
double t_0 = x + (y + 1.0);
double tmp;
if (y <= 9e-11) {
tmp = (x / (x + y)) * ((y / (x + y)) / (x + 1.0));
} else if (y <= 3.4e+160) {
tmp = (x / y) * (y / ((x + y) * t_0));
} else {
tmp = (x * ((1.0 - (x / y)) / y)) / 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 + (y + 1.0d0)
if (y <= 9d-11) then
tmp = (x / (x + y)) * ((y / (x + y)) / (x + 1.0d0))
else if (y <= 3.4d+160) then
tmp = (x / y) * (y / ((x + y) * t_0))
else
tmp = (x * ((1.0d0 - (x / y)) / y)) / t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x + (y + 1.0);
double tmp;
if (y <= 9e-11) {
tmp = (x / (x + y)) * ((y / (x + y)) / (x + 1.0));
} else if (y <= 3.4e+160) {
tmp = (x / y) * (y / ((x + y) * t_0));
} else {
tmp = (x * ((1.0 - (x / y)) / y)) / t_0;
}
return tmp;
}
def code(x, y): t_0 = x + (y + 1.0) tmp = 0 if y <= 9e-11: tmp = (x / (x + y)) * ((y / (x + y)) / (x + 1.0)) elif y <= 3.4e+160: tmp = (x / y) * (y / ((x + y) * t_0)) else: tmp = (x * ((1.0 - (x / y)) / y)) / t_0 return tmp
function code(x, y) t_0 = Float64(x + Float64(y + 1.0)) tmp = 0.0 if (y <= 9e-11) tmp = Float64(Float64(x / Float64(x + y)) * Float64(Float64(y / Float64(x + y)) / Float64(x + 1.0))); elseif (y <= 3.4e+160) tmp = Float64(Float64(x / y) * Float64(y / Float64(Float64(x + y) * t_0))); else tmp = Float64(Float64(x * Float64(Float64(1.0 - Float64(x / y)) / y)) / t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = x + (y + 1.0); tmp = 0.0; if (y <= 9e-11) tmp = (x / (x + y)) * ((y / (x + y)) / (x + 1.0)); elseif (y <= 3.4e+160) tmp = (x / y) * (y / ((x + y) * t_0)); else tmp = (x * ((1.0 - (x / y)) / y)) / t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 9e-11], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.4e+160], N[(N[(x / y), $MachinePrecision] * N[(y / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \left(y + 1\right)\\
\mathbf{if}\;y \leq 9 \cdot 10^{-11}:\\
\;\;\;\;\frac{x}{x + y} \cdot \frac{\frac{y}{x + y}}{x + 1}\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{+160}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{y}{\left(x + y\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{1 - \frac{x}{y}}{y}}{t\_0}\\
\end{array}
\end{array}
if y < 8.9999999999999999e-11Initial program 77.1%
+-commutative77.1%
+-commutative77.1%
+-commutative77.1%
*-commutative77.1%
distribute-rgt1-in51.2%
fma-define77.1%
+-commutative77.1%
+-commutative77.1%
cube-unmult77.1%
+-commutative77.1%
Simplified77.1%
fma-define51.2%
cube-mult51.2%
distribute-rgt1-in77.1%
*-commutative77.1%
associate-*l*77.0%
times-frac95.3%
associate-+r+95.3%
Applied egg-rr95.3%
div-inv95.2%
Applied egg-rr95.2%
associate-*r/95.3%
*-rgt-identity95.3%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in y around 0 80.4%
+-commutative80.4%
Simplified80.4%
if 8.9999999999999999e-11 < y < 3.4000000000000003e160Initial program 62.2%
+-commutative62.2%
+-commutative62.2%
+-commutative62.2%
*-commutative62.2%
distribute-rgt1-in56.8%
fma-define62.2%
+-commutative62.2%
+-commutative62.2%
cube-unmult62.2%
+-commutative62.2%
Simplified62.2%
fma-define56.8%
cube-mult56.8%
distribute-rgt1-in62.2%
*-commutative62.2%
associate-*l*62.2%
times-frac92.2%
associate-+r+92.2%
Applied egg-rr92.2%
Taylor expanded in x around 0 89.7%
if 3.4000000000000003e160 < y Initial program 55.9%
associate-/l*84.4%
associate-+l+84.4%
Simplified84.4%
Taylor expanded in x around 0 84.4%
pow184.4%
associate-/r*84.4%
*-commutative84.4%
Applied egg-rr84.4%
unpow184.4%
associate-*r/84.4%
associate-/r*90.0%
Simplified90.0%
Taylor expanded in y around inf 89.4%
mul-1-neg89.4%
unsub-neg89.4%
Simplified89.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x y))))
(if (<= y 5.8e-11)
(* t_0 (/ (/ y (+ x y)) (+ x 1.0)))
(if (<= y 5e+158)
(* (/ x y) (/ y (* (+ x y) (+ x (+ y 1.0)))))
(/ t_0 (+ y 1.0))))))
double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (y <= 5.8e-11) {
tmp = t_0 * ((y / (x + y)) / (x + 1.0));
} else if (y <= 5e+158) {
tmp = (x / y) * (y / ((x + y) * (x + (y + 1.0))));
} else {
tmp = t_0 / (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 / (x + y)
if (y <= 5.8d-11) then
tmp = t_0 * ((y / (x + y)) / (x + 1.0d0))
else if (y <= 5d+158) then
tmp = (x / y) * (y / ((x + y) * (x + (y + 1.0d0))))
else
tmp = t_0 / (y + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (y <= 5.8e-11) {
tmp = t_0 * ((y / (x + y)) / (x + 1.0));
} else if (y <= 5e+158) {
tmp = (x / y) * (y / ((x + y) * (x + (y + 1.0))));
} else {
tmp = t_0 / (y + 1.0);
}
return tmp;
}
def code(x, y): t_0 = x / (x + y) tmp = 0 if y <= 5.8e-11: tmp = t_0 * ((y / (x + y)) / (x + 1.0)) elif y <= 5e+158: tmp = (x / y) * (y / ((x + y) * (x + (y + 1.0)))) else: tmp = t_0 / (y + 1.0) return tmp
function code(x, y) t_0 = Float64(x / Float64(x + y)) tmp = 0.0 if (y <= 5.8e-11) tmp = Float64(t_0 * Float64(Float64(y / Float64(x + y)) / Float64(x + 1.0))); elseif (y <= 5e+158) tmp = Float64(Float64(x / y) * Float64(y / Float64(Float64(x + y) * Float64(x + Float64(y + 1.0))))); else tmp = Float64(t_0 / Float64(y + 1.0)); end return tmp end
function tmp_2 = code(x, y) t_0 = x / (x + y); tmp = 0.0; if (y <= 5.8e-11) tmp = t_0 * ((y / (x + y)) / (x + 1.0)); elseif (y <= 5e+158) tmp = (x / y) * (y / ((x + y) * (x + (y + 1.0)))); else tmp = t_0 / (y + 1.0); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 5.8e-11], N[(t$95$0 * N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e+158], N[(N[(x / y), $MachinePrecision] * N[(y / N[(N[(x + y), $MachinePrecision] * N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + y}\\
\mathbf{if}\;y \leq 5.8 \cdot 10^{-11}:\\
\;\;\;\;t\_0 \cdot \frac{\frac{y}{x + y}}{x + 1}\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+158}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{y}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{y + 1}\\
\end{array}
\end{array}
if y < 5.8e-11Initial program 77.1%
+-commutative77.1%
+-commutative77.1%
+-commutative77.1%
*-commutative77.1%
distribute-rgt1-in51.2%
fma-define77.1%
+-commutative77.1%
+-commutative77.1%
cube-unmult77.1%
+-commutative77.1%
Simplified77.1%
fma-define51.2%
cube-mult51.2%
distribute-rgt1-in77.1%
*-commutative77.1%
associate-*l*77.0%
times-frac95.3%
associate-+r+95.3%
Applied egg-rr95.3%
div-inv95.2%
Applied egg-rr95.2%
associate-*r/95.3%
*-rgt-identity95.3%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in y around 0 80.4%
+-commutative80.4%
Simplified80.4%
if 5.8e-11 < y < 4.9999999999999996e158Initial program 62.2%
+-commutative62.2%
+-commutative62.2%
+-commutative62.2%
*-commutative62.2%
distribute-rgt1-in56.8%
fma-define62.2%
+-commutative62.2%
+-commutative62.2%
cube-unmult62.2%
+-commutative62.2%
Simplified62.2%
fma-define56.8%
cube-mult56.8%
distribute-rgt1-in62.2%
*-commutative62.2%
associate-*l*62.2%
times-frac92.2%
associate-+r+92.2%
Applied egg-rr92.2%
Taylor expanded in x around 0 89.7%
if 4.9999999999999996e158 < y Initial program 55.9%
+-commutative55.9%
+-commutative55.9%
+-commutative55.9%
*-commutative55.9%
distribute-rgt1-in55.9%
fma-define55.9%
+-commutative55.9%
+-commutative55.9%
cube-unmult55.9%
+-commutative55.9%
Simplified55.9%
fma-define55.9%
cube-mult55.9%
distribute-rgt1-in55.9%
*-commutative55.9%
associate-*l*55.9%
times-frac84.4%
associate-+r+84.4%
Applied egg-rr84.4%
div-inv84.4%
Applied egg-rr84.4%
associate-*r/84.4%
*-rgt-identity84.4%
associate-/r*99.8%
Simplified99.8%
div-inv99.8%
*-inverses99.8%
associate-/r*84.4%
clear-num84.4%
un-div-inv84.4%
*-inverses84.4%
div-inv84.4%
+-commutative84.4%
associate-/l*100.0%
+-commutative100.0%
associate-+r+100.0%
+-commutative100.0%
associate-+l+100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 89.8%
+-commutative89.8%
Simplified89.8%
Final simplification83.1%
(FPCore (x y)
:precision binary64
(if (<= y 3.2e-165)
(/ (/ y x) (+ x 1.0))
(if (<= y 6e-8)
(* x (/ y (* (+ x 1.0) (* (+ x y) (+ x y)))))
(/ (/ x (+ x y)) (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= 3.2e-165) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 6e-8) {
tmp = x * (y / ((x + 1.0) * ((x + y) * (x + y))));
} else {
tmp = (x / (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 <= 3.2d-165) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 6d-8) then
tmp = x * (y / ((x + 1.0d0) * ((x + y) * (x + y))))
else
tmp = (x / (x + y)) / (y + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 3.2e-165) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 6e-8) {
tmp = x * (y / ((x + 1.0) * ((x + y) * (x + y))));
} else {
tmp = (x / (x + y)) / (y + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 3.2e-165: tmp = (y / x) / (x + 1.0) elif y <= 6e-8: tmp = x * (y / ((x + 1.0) * ((x + y) * (x + y)))) else: tmp = (x / (x + y)) / (y + 1.0) return tmp
function code(x, y) tmp = 0.0 if (y <= 3.2e-165) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 6e-8) tmp = Float64(x * Float64(y / Float64(Float64(x + 1.0) * Float64(Float64(x + y) * Float64(x + y))))); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(y + 1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 3.2e-165) tmp = (y / x) / (x + 1.0); elseif (y <= 6e-8) tmp = x * (y / ((x + 1.0) * ((x + y) * (x + y)))); else tmp = (x / (x + y)) / (y + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 3.2e-165], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6e-8], N[(x * N[(y / N[(N[(x + 1.0), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.2 \cdot 10^{-165}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 6 \cdot 10^{-8}:\\
\;\;\;\;x \cdot \frac{y}{\left(x + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\
\end{array}
\end{array}
if y < 3.20000000000000013e-165Initial program 75.5%
+-commutative75.5%
+-commutative75.5%
+-commutative75.5%
*-commutative75.5%
distribute-rgt1-in49.8%
fma-define75.4%
+-commutative75.4%
+-commutative75.4%
cube-unmult75.5%
+-commutative75.5%
Simplified75.5%
fma-define49.8%
cube-mult49.8%
distribute-rgt1-in75.5%
*-commutative75.5%
associate-*l*75.4%
times-frac94.7%
associate-+r+94.7%
Applied egg-rr94.7%
Taylor expanded in y around 0 56.0%
associate-/r*57.1%
+-commutative57.1%
Simplified57.1%
if 3.20000000000000013e-165 < y < 5.99999999999999946e-8Initial program 89.3%
associate-/l*88.9%
associate-+l+88.9%
Simplified88.9%
Taylor expanded in y around 0 88.9%
+-commutative99.9%
Simplified88.9%
if 5.99999999999999946e-8 < y Initial program 58.6%
+-commutative58.6%
+-commutative58.6%
+-commutative58.6%
*-commutative58.6%
distribute-rgt1-in55.8%
fma-define58.6%
+-commutative58.6%
+-commutative58.6%
cube-unmult58.6%
+-commutative58.6%
Simplified58.6%
fma-define55.8%
cube-mult55.8%
distribute-rgt1-in58.6%
*-commutative58.6%
associate-*l*58.5%
times-frac88.2%
associate-+r+88.2%
Applied egg-rr88.2%
div-inv88.2%
Applied egg-rr88.2%
associate-*r/88.2%
*-rgt-identity88.2%
associate-/r*99.6%
Simplified99.6%
div-inv99.6%
*-inverses99.6%
associate-/r*88.2%
clear-num88.1%
un-div-inv88.2%
*-inverses88.2%
div-inv88.3%
+-commutative88.3%
associate-/l*99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 79.1%
+-commutative79.1%
Simplified79.1%
Final simplification66.2%
(FPCore (x y)
:precision binary64
(if (<= y 1.2e-88)
(/ (/ y x) (+ x 1.0))
(if (<= y 6.5e+103)
(* x (/ y (* (+ x (+ y 1.0)) (* y (+ x y)))))
(/ (/ x (+ x y)) (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= 1.2e-88) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 6.5e+103) {
tmp = x * (y / ((x + (y + 1.0)) * (y * (x + y))));
} else {
tmp = (x / (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.2d-88) then
tmp = (y / x) / (x + 1.0d0)
else if (y <= 6.5d+103) then
tmp = x * (y / ((x + (y + 1.0d0)) * (y * (x + y))))
else
tmp = (x / (x + y)) / (y + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.2e-88) {
tmp = (y / x) / (x + 1.0);
} else if (y <= 6.5e+103) {
tmp = x * (y / ((x + (y + 1.0)) * (y * (x + y))));
} else {
tmp = (x / (x + y)) / (y + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.2e-88: tmp = (y / x) / (x + 1.0) elif y <= 6.5e+103: tmp = x * (y / ((x + (y + 1.0)) * (y * (x + y)))) else: tmp = (x / (x + y)) / (y + 1.0) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.2e-88) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); elseif (y <= 6.5e+103) tmp = Float64(x * Float64(y / Float64(Float64(x + Float64(y + 1.0)) * Float64(y * Float64(x + y))))); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(y + 1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.2e-88) tmp = (y / x) / (x + 1.0); elseif (y <= 6.5e+103) tmp = x * (y / ((x + (y + 1.0)) * (y * (x + y)))); else tmp = (x / (x + y)) / (y + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.2e-88], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.5e+103], N[(x * N[(y / N[(N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision] * N[(y * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.2 \cdot 10^{-88}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+103}:\\
\;\;\;\;x \cdot \frac{y}{\left(x + \left(y + 1\right)\right) \cdot \left(y \cdot \left(x + y\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\
\end{array}
\end{array}
if y < 1.2e-88Initial program 76.3%
+-commutative76.3%
+-commutative76.3%
+-commutative76.3%
*-commutative76.3%
distribute-rgt1-in50.1%
fma-define76.3%
+-commutative76.3%
+-commutative76.3%
cube-unmult76.3%
+-commutative76.3%
Simplified76.3%
fma-define50.1%
cube-mult50.1%
distribute-rgt1-in76.3%
*-commutative76.3%
associate-*l*76.3%
times-frac95.0%
associate-+r+95.0%
Applied egg-rr95.0%
Taylor expanded in y around 0 58.5%
associate-/r*59.5%
+-commutative59.5%
Simplified59.5%
if 1.2e-88 < y < 6.50000000000000001e103Initial program 90.2%
associate-/l*93.5%
associate-+l+93.5%
Simplified93.5%
Taylor expanded in x around 0 77.5%
if 6.50000000000000001e103 < y Initial program 47.7%
+-commutative47.7%
+-commutative47.7%
+-commutative47.7%
*-commutative47.7%
distribute-rgt1-in47.7%
fma-define47.7%
+-commutative47.7%
+-commutative47.7%
cube-unmult47.7%
+-commutative47.7%
Simplified47.7%
fma-define47.7%
cube-mult47.7%
distribute-rgt1-in47.7%
*-commutative47.7%
associate-*l*47.7%
times-frac86.0%
associate-+r+86.0%
Applied egg-rr86.0%
div-inv86.0%
Applied egg-rr86.0%
associate-*r/86.0%
*-rgt-identity86.0%
associate-/r*99.7%
Simplified99.7%
div-inv99.6%
*-inverses99.6%
associate-/r*85.9%
clear-num85.9%
un-div-inv86.0%
*-inverses86.0%
div-inv86.0%
+-commutative86.0%
associate-/l*99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 84.2%
+-commutative84.2%
Simplified84.2%
Final simplification66.8%
(FPCore (x y) :precision binary64 (if (<= x -7e-5) (/ (/ y x) x) (if (or (<= x -2.6e-118) (not (<= x 2.6e-252))) (/ x (* y y)) (/ x y))))
double code(double x, double y) {
double tmp;
if (x <= -7e-5) {
tmp = (y / x) / x;
} else if ((x <= -2.6e-118) || !(x <= 2.6e-252)) {
tmp = x / (y * y);
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-7d-5)) then
tmp = (y / x) / x
else if ((x <= (-2.6d-118)) .or. (.not. (x <= 2.6d-252))) then
tmp = x / (y * y)
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -7e-5) {
tmp = (y / x) / x;
} else if ((x <= -2.6e-118) || !(x <= 2.6e-252)) {
tmp = x / (y * y);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -7e-5: tmp = (y / x) / x elif (x <= -2.6e-118) or not (x <= 2.6e-252): tmp = x / (y * y) else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if (x <= -7e-5) tmp = Float64(Float64(y / x) / x); elseif ((x <= -2.6e-118) || !(x <= 2.6e-252)) tmp = Float64(x / Float64(y * y)); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -7e-5) tmp = (y / x) / x; elseif ((x <= -2.6e-118) || ~((x <= 2.6e-252))) tmp = x / (y * y); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -7e-5], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[Or[LessEqual[x, -2.6e-118], N[Not[LessEqual[x, 2.6e-252]], $MachinePrecision]], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;x \leq -2.6 \cdot 10^{-118} \lor \neg \left(x \leq 2.6 \cdot 10^{-252}\right):\\
\;\;\;\;\frac{x}{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -6.9999999999999994e-5Initial program 68.9%
+-commutative68.9%
+-commutative68.9%
+-commutative68.9%
*-commutative68.9%
distribute-rgt1-in25.9%
fma-define68.9%
+-commutative68.9%
+-commutative68.9%
cube-unmult68.9%
+-commutative68.9%
Simplified68.9%
fma-define25.9%
cube-mult25.9%
distribute-rgt1-in68.9%
*-commutative68.9%
associate-*l*68.9%
times-frac89.5%
associate-+r+89.5%
Applied egg-rr89.5%
Taylor expanded in y around 0 72.5%
associate-/r*76.8%
+-commutative76.8%
Simplified76.8%
Taylor expanded in x around inf 75.3%
if -6.9999999999999994e-5 < x < -2.6e-118 or 2.5999999999999999e-252 < x Initial program 74.1%
associate-/l*84.4%
associate-+l+84.4%
Simplified84.4%
Taylor expanded in x around 0 46.8%
Taylor expanded in y around inf 42.3%
if -2.6e-118 < x < 2.5999999999999999e-252Initial program 69.1%
associate-/l*78.5%
associate-+l+78.5%
Simplified78.5%
Taylor expanded in x around 0 91.1%
associate-/r*91.0%
+-commutative91.0%
Simplified91.0%
Taylor expanded in y around 0 69.9%
Final simplification55.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x y))))
(if (<= y 1.2)
(* t_0 (/ (/ y (+ x y)) (+ x 1.0)))
(/ t_0 (* (+ x y) (/ (+ x y) y))))))
double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (y <= 1.2) {
tmp = t_0 * ((y / (x + y)) / (x + 1.0));
} else {
tmp = t_0 / ((x + y) * ((x + y) / 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 = x / (x + y)
if (y <= 1.2d0) then
tmp = t_0 * ((y / (x + y)) / (x + 1.0d0))
else
tmp = t_0 / ((x + y) * ((x + y) / y))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (x + y);
double tmp;
if (y <= 1.2) {
tmp = t_0 * ((y / (x + y)) / (x + 1.0));
} else {
tmp = t_0 / ((x + y) * ((x + y) / y));
}
return tmp;
}
def code(x, y): t_0 = x / (x + y) tmp = 0 if y <= 1.2: tmp = t_0 * ((y / (x + y)) / (x + 1.0)) else: tmp = t_0 / ((x + y) * ((x + y) / y)) return tmp
function code(x, y) t_0 = Float64(x / Float64(x + y)) tmp = 0.0 if (y <= 1.2) tmp = Float64(t_0 * Float64(Float64(y / Float64(x + y)) / Float64(x + 1.0))); else tmp = Float64(t_0 / Float64(Float64(x + y) * Float64(Float64(x + y) / y))); end return tmp end
function tmp_2 = code(x, y) t_0 = x / (x + y); tmp = 0.0; if (y <= 1.2) tmp = t_0 * ((y / (x + y)) / (x + 1.0)); else tmp = t_0 / ((x + y) * ((x + y) / y)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.2], N[(t$95$0 * N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(N[(x + y), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + y}\\
\mathbf{if}\;y \leq 1.2:\\
\;\;\;\;t\_0 \cdot \frac{\frac{y}{x + y}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{\left(x + y\right) \cdot \frac{x + y}{y}}\\
\end{array}
\end{array}
if y < 1.19999999999999996Initial program 77.4%
+-commutative77.4%
+-commutative77.4%
+-commutative77.4%
*-commutative77.4%
distribute-rgt1-in52.0%
fma-define77.4%
+-commutative77.4%
+-commutative77.4%
cube-unmult77.4%
+-commutative77.4%
Simplified77.4%
fma-define52.0%
cube-mult52.0%
distribute-rgt1-in77.4%
*-commutative77.4%
associate-*l*77.4%
times-frac95.4%
associate-+r+95.4%
Applied egg-rr95.4%
div-inv95.3%
Applied egg-rr95.3%
associate-*r/95.4%
*-rgt-identity95.4%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in y around 0 80.0%
+-commutative80.0%
Simplified80.0%
if 1.19999999999999996 < y Initial program 57.4%
+-commutative57.4%
+-commutative57.4%
+-commutative57.4%
*-commutative57.4%
distribute-rgt1-in54.5%
fma-define57.4%
+-commutative57.4%
+-commutative57.4%
cube-unmult57.4%
+-commutative57.4%
Simplified57.4%
fma-define54.5%
cube-mult54.5%
distribute-rgt1-in57.4%
*-commutative57.4%
associate-*l*57.4%
times-frac87.9%
associate-+r+87.9%
Applied egg-rr87.9%
div-inv87.9%
Applied egg-rr87.9%
associate-*r/87.9%
*-rgt-identity87.9%
associate-/r*99.7%
Simplified99.7%
div-inv99.6%
*-inverses99.6%
associate-/r*87.9%
clear-num87.8%
un-div-inv87.9%
*-inverses87.9%
div-inv88.0%
+-commutative88.0%
associate-/l*99.8%
+-commutative99.8%
associate-+r+99.8%
+-commutative99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 99.1%
Final simplification85.3%
(FPCore (x y) :precision binary64 (if (<= y 2.65e-9) (/ (/ y x) (+ x 1.0)) (/ (/ x (+ x y)) (+ y 1.0))))
double code(double x, double y) {
double tmp;
if (y <= 2.65e-9) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (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 <= 2.65d-9) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / (x + y)) / (y + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2.65e-9) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / (x + y)) / (y + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.65e-9: tmp = (y / x) / (x + 1.0) else: tmp = (x / (x + y)) / (y + 1.0) return tmp
function code(x, y) tmp = 0.0 if (y <= 2.65e-9) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(x / Float64(x + y)) / Float64(y + 1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2.65e-9) tmp = (y / x) / (x + 1.0); else tmp = (x / (x + y)) / (y + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.65e-9], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.65 \cdot 10^{-9}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\
\end{array}
\end{array}
if y < 2.65000000000000015e-9Initial program 77.2%
+-commutative77.2%
+-commutative77.2%
+-commutative77.2%
*-commutative77.2%
distribute-rgt1-in51.5%
fma-define77.2%
+-commutative77.2%
+-commutative77.2%
cube-unmult77.2%
+-commutative77.2%
Simplified77.2%
fma-define51.5%
cube-mult51.5%
distribute-rgt1-in77.2%
*-commutative77.2%
associate-*l*77.2%
times-frac95.3%
associate-+r+95.3%
Applied egg-rr95.3%
Taylor expanded in y around 0 59.9%
associate-/r*60.9%
+-commutative60.9%
Simplified60.9%
if 2.65000000000000015e-9 < y Initial program 58.6%
+-commutative58.6%
+-commutative58.6%
+-commutative58.6%
*-commutative58.6%
distribute-rgt1-in55.8%
fma-define58.6%
+-commutative58.6%
+-commutative58.6%
cube-unmult58.6%
+-commutative58.6%
Simplified58.6%
fma-define55.8%
cube-mult55.8%
distribute-rgt1-in58.6%
*-commutative58.6%
associate-*l*58.5%
times-frac88.2%
associate-+r+88.2%
Applied egg-rr88.2%
div-inv88.2%
Applied egg-rr88.2%
associate-*r/88.2%
*-rgt-identity88.2%
associate-/r*99.6%
Simplified99.6%
div-inv99.6%
*-inverses99.6%
associate-/r*88.2%
clear-num88.1%
un-div-inv88.2%
*-inverses88.2%
div-inv88.3%
+-commutative88.3%
associate-/l*99.7%
+-commutative99.7%
associate-+r+99.7%
+-commutative99.7%
associate-+l+99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 79.1%
+-commutative79.1%
Simplified79.1%
Final simplification66.1%
(FPCore (x y) :precision binary64 (if (<= y 4.8e-9) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (+ y 1.0))))
double code(double x, double y) {
double tmp;
if (y <= 4.8e-9) {
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 (y <= 4.8d-9) 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 (y <= 4.8e-9) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 4.8e-9: tmp = (y / x) / (x + 1.0) else: tmp = (x / y) / (y + 1.0) return tmp
function code(x, y) tmp = 0.0 if (y <= 4.8e-9) tmp = Float64(Float64(y / 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 (y <= 4.8e-9) tmp = (y / x) / (x + 1.0); else tmp = (x / y) / (y + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 4.8e-9], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.8 \cdot 10^{-9}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if y < 4.8e-9Initial program 77.2%
+-commutative77.2%
+-commutative77.2%
+-commutative77.2%
*-commutative77.2%
distribute-rgt1-in51.5%
fma-define77.2%
+-commutative77.2%
+-commutative77.2%
cube-unmult77.2%
+-commutative77.2%
Simplified77.2%
fma-define51.5%
cube-mult51.5%
distribute-rgt1-in77.2%
*-commutative77.2%
associate-*l*77.2%
times-frac95.3%
associate-+r+95.3%
Applied egg-rr95.3%
Taylor expanded in y around 0 59.9%
associate-/r*60.9%
+-commutative60.9%
Simplified60.9%
if 4.8e-9 < y Initial program 58.6%
associate-/l*78.2%
associate-+l+78.2%
Simplified78.2%
Taylor expanded in x around 0 77.6%
associate-/r*78.7%
+-commutative78.7%
Simplified78.7%
(FPCore (x y) :precision binary64 (if (<= y 1.22e-8) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
double code(double x, double y) {
double tmp;
if (y <= 1.22e-8) {
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 (y <= 1.22d-8) 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 (y <= 1.22e-8) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.22e-8: tmp = y / (x * (x + 1.0)) else: tmp = (x / y) / (y + 1.0) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.22e-8) 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 (y <= 1.22e-8) tmp = y / (x * (x + 1.0)); else tmp = (x / y) / (y + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.22e-8], 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}\;y \leq 1.22 \cdot 10^{-8}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if y < 1.22e-8Initial program 77.2%
associate-/l*83.5%
associate-+l+83.5%
Simplified83.5%
Taylor expanded in y around 0 59.9%
+-commutative59.9%
Simplified59.9%
if 1.22e-8 < y Initial program 58.6%
associate-/l*78.2%
associate-+l+78.2%
Simplified78.2%
Taylor expanded in x around 0 77.6%
associate-/r*78.7%
+-commutative78.7%
Simplified78.7%
(FPCore (x y) :precision binary64 (if (<= y 6.7e-9) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= 6.7e-9) {
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 (y <= 6.7d-9) 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 (y <= 6.7e-9) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 6.7e-9: tmp = y / (x * (x + 1.0)) else: tmp = x / (y * (y + 1.0)) return tmp
function code(x, y) tmp = 0.0 if (y <= 6.7e-9) 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 (y <= 6.7e-9) tmp = y / (x * (x + 1.0)); else tmp = x / (y * (y + 1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 6.7e-9], 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}\;y \leq 6.7 \cdot 10^{-9}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 6.69999999999999961e-9Initial program 77.2%
associate-/l*83.5%
associate-+l+83.5%
Simplified83.5%
Taylor expanded in y around 0 59.9%
+-commutative59.9%
Simplified59.9%
if 6.69999999999999961e-9 < y Initial program 58.6%
associate-/l*78.2%
associate-+l+78.2%
Simplified78.2%
Taylor expanded in x around 0 77.6%
Final simplification64.9%
(FPCore (x y) :precision binary64 (if (<= x -7e-5) (/ (/ y x) x) (/ x (* y (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if (x <= -7e-5) {
tmp = (y / x) / x;
} 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 <= (-7d-5)) then
tmp = (y / x) / x
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 <= -7e-5) {
tmp = (y / x) / x;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -7e-5: tmp = (y / x) / x else: tmp = x / (y * (y + 1.0)) return tmp
function code(x, y) tmp = 0.0 if (x <= -7e-5) tmp = Float64(Float64(y / x) / x); 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 <= -7e-5) tmp = (y / x) / x; else tmp = x / (y * (y + 1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -7e-5], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -6.9999999999999994e-5Initial program 68.9%
+-commutative68.9%
+-commutative68.9%
+-commutative68.9%
*-commutative68.9%
distribute-rgt1-in25.9%
fma-define68.9%
+-commutative68.9%
+-commutative68.9%
cube-unmult68.9%
+-commutative68.9%
Simplified68.9%
fma-define25.9%
cube-mult25.9%
distribute-rgt1-in68.9%
*-commutative68.9%
associate-*l*68.9%
times-frac89.5%
associate-+r+89.5%
Applied egg-rr89.5%
Taylor expanded in y around 0 72.5%
associate-/r*76.8%
+-commutative76.8%
Simplified76.8%
Taylor expanded in x around inf 75.3%
if -6.9999999999999994e-5 < x Initial program 72.9%
associate-/l*82.9%
associate-+l+82.9%
Simplified82.9%
Taylor expanded in x around 0 57.8%
Final simplification62.1%
(FPCore (x y) :precision binary64 (if (<= y 1.0) (/ x y) (/ x (* y y))))
double code(double x, double y) {
double tmp;
if (y <= 1.0) {
tmp = x / y;
} else {
tmp = x / (y * y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.0d0) then
tmp = x / y
else
tmp = x / (y * y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.0) {
tmp = x / y;
} else {
tmp = x / (y * y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.0: tmp = x / y else: tmp = x / (y * y) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.0) tmp = Float64(x / y); else tmp = Float64(x / Float64(y * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.0) tmp = x / y; else tmp = x / (y * y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.0], N[(x / y), $MachinePrecision], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot y}\\
\end{array}
\end{array}
if y < 1Initial program 77.4%
associate-/l*83.7%
associate-+l+83.7%
Simplified83.7%
Taylor expanded in x around 0 38.5%
associate-/r*40.2%
+-commutative40.2%
Simplified40.2%
Taylor expanded in y around 0 21.0%
if 1 < y Initial program 57.4%
associate-/l*77.6%
associate-+l+77.6%
Simplified77.6%
Taylor expanded in x around 0 77.0%
Taylor expanded in y around inf 76.3%
Final simplification36.3%
(FPCore (x y) :precision binary64 (/ x (* y y)))
double code(double x, double y) {
return x / (y * y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / (y * y)
end function
public static double code(double x, double y) {
return x / (y * y);
}
def code(x, y): return x / (y * y)
function code(x, y) return Float64(x / Float64(y * y)) end
function tmp = code(x, y) tmp = x / (y * y); end
code[x_, y_] := N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y \cdot y}
\end{array}
Initial program 71.9%
associate-/l*82.0%
associate-+l+82.0%
Simplified82.0%
Taylor expanded in x around 0 49.1%
Taylor expanded in y around inf 40.3%
(FPCore (x y) :precision binary64 (/ 1.0 (+ x 1.0)))
double code(double x, double y) {
return 1.0 / (x + 1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 / (x + 1.0d0)
end function
public static double code(double x, double y) {
return 1.0 / (x + 1.0);
}
def code(x, y): return 1.0 / (x + 1.0)
function code(x, y) return Float64(1.0 / Float64(x + 1.0)) end
function tmp = code(x, y) tmp = 1.0 / (x + 1.0); end
code[x_, y_] := N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x + 1}
\end{array}
Initial program 71.9%
associate-/l*82.0%
associate-+l+82.0%
Simplified82.0%
Taylor expanded in x around 0 62.8%
Taylor expanded in y around 0 4.8%
+-commutative4.8%
Simplified4.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 71.9%
+-commutative71.9%
+-commutative71.9%
+-commutative71.9%
*-commutative71.9%
distribute-rgt1-in52.7%
fma-define71.9%
+-commutative71.9%
+-commutative71.9%
cube-unmult71.9%
+-commutative71.9%
Simplified71.9%
fma-define52.7%
cube-mult52.7%
distribute-rgt1-in71.9%
*-commutative71.9%
associate-*l*71.9%
times-frac93.3%
associate-+r+93.3%
Applied egg-rr93.3%
Taylor expanded in x around inf 68.7%
Taylor expanded in y around inf 4.0%
Taylor expanded in y around 0 4.0%
(FPCore (x y) :precision binary64 (/ 1.0 x))
double code(double x, double y) {
return 1.0 / x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 / x
end function
public static double code(double x, double y) {
return 1.0 / x;
}
def code(x, y): return 1.0 / x
function code(x, y) return Float64(1.0 / x) end
function tmp = code(x, y) tmp = 1.0 / x; end
code[x_, y_] := N[(1.0 / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x}
\end{array}
Initial program 71.9%
associate-/l*82.0%
associate-+l+82.0%
Simplified82.0%
Taylor expanded in x around 0 62.8%
Taylor expanded in x around inf 4.2%
(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 2024185
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
:precision binary64
:alt
(! :herbie-platform default (/ (/ (/ x (+ (+ y 1) x)) (+ y x)) (/ 1 (/ y (+ y x)))))
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))