
(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 (/ (/ y (+ x y)) (+ y (+ x 1.0)))) (+ x y)))
double code(double x, double y) {
return (x * ((y / (x + y)) / (y + (x + 1.0)))) / (x + y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * ((y / (x + y)) / (y + (x + 1.0d0)))) / (x + y)
end function
public static double code(double x, double y) {
return (x * ((y / (x + y)) / (y + (x + 1.0)))) / (x + y);
}
def code(x, y): return (x * ((y / (x + y)) / (y + (x + 1.0)))) / (x + y)
function code(x, y) return Float64(Float64(x * Float64(Float64(y / Float64(x + y)) / Float64(y + Float64(x + 1.0)))) / Float64(x + y)) end
function tmp = code(x, y) tmp = (x * ((y / (x + y)) / (y + (x + 1.0)))) / (x + y); end
code[x_, y_] := N[(N[(x * N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \frac{\frac{y}{x + y}}{y + \left(x + 1\right)}}{x + y}
\end{array}
Initial program 65.4%
+-commutative65.4%
+-commutative65.4%
+-commutative65.4%
*-commutative65.4%
distribute-rgt1-in53.8%
fma-define65.4%
+-commutative65.4%
+-commutative65.4%
cube-unmult65.4%
+-commutative65.4%
Simplified65.4%
*-commutative65.4%
fma-define53.8%
cube-mult53.8%
distribute-rgt1-in65.4%
*-commutative65.4%
associate-*l*65.4%
times-frac93.0%
associate-+r+93.0%
Applied egg-rr93.0%
associate-*r/93.0%
+-commutative93.0%
+-commutative93.0%
+-commutative93.0%
associate-+l+93.0%
+-commutative93.0%
Applied egg-rr93.0%
*-un-lft-identity93.0%
times-frac99.7%
*-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.9%
*-lft-identity99.9%
associate-/l*99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ x y))))
(if (or (<= y -4e+50) (not (<= y 1.35e-24)))
(/ (* x (/ t_0 (+ x y))) (+ x y))
(* t_0 (/ x (* (+ x y) (+ x 1.0)))))))
double code(double x, double y) {
double t_0 = y / (x + y);
double tmp;
if ((y <= -4e+50) || !(y <= 1.35e-24)) {
tmp = (x * (t_0 / (x + y))) / (x + y);
} else {
tmp = t_0 * (x / ((x + y) * (x + 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 = y / (x + y)
if ((y <= (-4d+50)) .or. (.not. (y <= 1.35d-24))) then
tmp = (x * (t_0 / (x + y))) / (x + y)
else
tmp = t_0 * (x / ((x + y) * (x + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y / (x + y);
double tmp;
if ((y <= -4e+50) || !(y <= 1.35e-24)) {
tmp = (x * (t_0 / (x + y))) / (x + y);
} else {
tmp = t_0 * (x / ((x + y) * (x + 1.0)));
}
return tmp;
}
def code(x, y): t_0 = y / (x + y) tmp = 0 if (y <= -4e+50) or not (y <= 1.35e-24): tmp = (x * (t_0 / (x + y))) / (x + y) else: tmp = t_0 * (x / ((x + y) * (x + 1.0))) return tmp
function code(x, y) t_0 = Float64(y / Float64(x + y)) tmp = 0.0 if ((y <= -4e+50) || !(y <= 1.35e-24)) tmp = Float64(Float64(x * Float64(t_0 / Float64(x + y))) / Float64(x + y)); else tmp = Float64(t_0 * Float64(x / Float64(Float64(x + y) * Float64(x + 1.0)))); end return tmp end
function tmp_2 = code(x, y) t_0 = y / (x + y); tmp = 0.0; if ((y <= -4e+50) || ~((y <= 1.35e-24))) tmp = (x * (t_0 / (x + y))) / (x + y); else tmp = t_0 * (x / ((x + y) * (x + 1.0))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[y, -4e+50], N[Not[LessEqual[y, 1.35e-24]], $MachinePrecision]], N[(N[(x * N[(t$95$0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(x / N[(N[(x + y), $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{x + y}\\
\mathbf{if}\;y \leq -4 \cdot 10^{+50} \lor \neg \left(y \leq 1.35 \cdot 10^{-24}\right):\\
\;\;\;\;\frac{x \cdot \frac{t\_0}{x + y}}{x + y}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{x}{\left(x + y\right) \cdot \left(x + 1\right)}\\
\end{array}
\end{array}
if y < -4.0000000000000003e50 or 1.35000000000000003e-24 < y Initial program 57.7%
+-commutative57.7%
+-commutative57.7%
+-commutative57.7%
*-commutative57.7%
distribute-rgt1-in43.8%
fma-define57.7%
+-commutative57.7%
+-commutative57.7%
cube-unmult57.7%
+-commutative57.7%
Simplified57.7%
*-commutative57.7%
fma-define43.8%
cube-mult43.8%
distribute-rgt1-in57.7%
*-commutative57.7%
associate-*l*57.7%
times-frac86.0%
associate-+r+86.0%
Applied egg-rr86.0%
associate-*r/86.0%
+-commutative86.0%
+-commutative86.0%
+-commutative86.0%
associate-+l+86.0%
+-commutative86.0%
Applied egg-rr86.0%
*-un-lft-identity86.0%
times-frac99.8%
*-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-lft-identity99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around inf 99.8%
if -4.0000000000000003e50 < y < 1.35000000000000003e-24Initial program 73.0%
Taylor expanded in x around inf 72.7%
*-commutative72.7%
associate-*l*72.7%
times-frac99.6%
+-commutative99.6%
+-commutative99.6%
Applied egg-rr99.6%
Final simplification99.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= y 0.014)
(* (/ y (+ x y)) (/ x (* (+ x y) (+ x 1.0))))
(if (<= y 1.22e+149)
(/ x (* (+ x y) t_0))
(* (/ 1.0 t_0) (/ x (+ x y)))))))
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (y <= 0.014) {
tmp = (y / (x + y)) * (x / ((x + y) * (x + 1.0)));
} else if (y <= 1.22e+149) {
tmp = x / ((x + y) * t_0);
} else {
tmp = (1.0 / t_0) * (x / (x + y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y + (x + 1.0d0)
if (y <= 0.014d0) then
tmp = (y / (x + y)) * (x / ((x + y) * (x + 1.0d0)))
else if (y <= 1.22d+149) then
tmp = x / ((x + y) * t_0)
else
tmp = (1.0d0 / t_0) * (x / (x + y))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (y <= 0.014) {
tmp = (y / (x + y)) * (x / ((x + y) * (x + 1.0)));
} else if (y <= 1.22e+149) {
tmp = x / ((x + y) * t_0);
} else {
tmp = (1.0 / t_0) * (x / (x + y));
}
return tmp;
}
def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if y <= 0.014: tmp = (y / (x + y)) * (x / ((x + y) * (x + 1.0))) elif y <= 1.22e+149: tmp = x / ((x + y) * t_0) else: tmp = (1.0 / t_0) * (x / (x + y)) return tmp
function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (y <= 0.014) tmp = Float64(Float64(y / Float64(x + y)) * Float64(x / Float64(Float64(x + y) * Float64(x + 1.0)))); elseif (y <= 1.22e+149) tmp = Float64(x / Float64(Float64(x + y) * t_0)); else tmp = Float64(Float64(1.0 / t_0) * Float64(x / Float64(x + y))); end return tmp end
function tmp_2 = code(x, y) t_0 = y + (x + 1.0); tmp = 0.0; if (y <= 0.014) tmp = (y / (x + y)) * (x / ((x + y) * (x + 1.0))); elseif (y <= 1.22e+149) tmp = x / ((x + y) * t_0); else tmp = (1.0 / t_0) * (x / (x + y)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 0.014], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(x / N[(N[(x + y), $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.22e+149], N[(x / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;y \leq 0.014:\\
\;\;\;\;\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + 1\right)}\\
\mathbf{elif}\;y \leq 1.22 \cdot 10^{+149}:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_0} \cdot \frac{x}{x + y}\\
\end{array}
\end{array}
if y < 0.0140000000000000003Initial program 64.7%
Taylor expanded in x around inf 62.1%
*-commutative62.1%
associate-*l*62.1%
times-frac88.8%
+-commutative88.8%
+-commutative88.8%
Applied egg-rr88.8%
if 0.0140000000000000003 < y < 1.22e149Initial program 68.4%
+-commutative68.4%
+-commutative68.4%
+-commutative68.4%
*-commutative68.4%
distribute-rgt1-in60.0%
fma-define68.4%
+-commutative68.4%
+-commutative68.4%
cube-unmult68.5%
+-commutative68.5%
Simplified68.5%
*-commutative68.5%
fma-define60.1%
cube-mult60.0%
distribute-rgt1-in68.4%
*-commutative68.4%
associate-*l*68.4%
times-frac87.1%
associate-+r+87.1%
Applied egg-rr87.1%
associate-*r/87.1%
+-commutative87.1%
+-commutative87.1%
+-commutative87.1%
associate-+l+87.1%
+-commutative87.1%
Applied egg-rr87.1%
Taylor expanded in y around inf 84.1%
if 1.22e149 < y Initial program 66.7%
+-commutative66.7%
+-commutative66.7%
+-commutative66.7%
*-commutative66.7%
distribute-rgt1-in66.7%
fma-define66.7%
+-commutative66.7%
+-commutative66.7%
cube-unmult66.7%
+-commutative66.7%
Simplified66.7%
*-commutative66.7%
fma-define66.7%
cube-mult66.7%
distribute-rgt1-in66.7%
*-commutative66.7%
associate-*l*66.7%
times-frac84.5%
associate-+r+84.5%
Applied egg-rr84.5%
*-un-lft-identity84.5%
*-commutative84.5%
+-commutative84.5%
associate-+l+84.5%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 93.4%
Final simplification88.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= y 3.8e-85)
(/ (/ y (+ x y)) (+ x 1.0))
(if (<= y 5e+146) (/ x (* (+ x y) t_0)) (* (/ 1.0 t_0) (/ x (+ x y)))))))
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (y <= 3.8e-85) {
tmp = (y / (x + y)) / (x + 1.0);
} else if (y <= 5e+146) {
tmp = x / ((x + y) * t_0);
} else {
tmp = (1.0 / t_0) * (x / (x + y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y + (x + 1.0d0)
if (y <= 3.8d-85) then
tmp = (y / (x + y)) / (x + 1.0d0)
else if (y <= 5d+146) then
tmp = x / ((x + y) * t_0)
else
tmp = (1.0d0 / t_0) * (x / (x + y))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (y <= 3.8e-85) {
tmp = (y / (x + y)) / (x + 1.0);
} else if (y <= 5e+146) {
tmp = x / ((x + y) * t_0);
} else {
tmp = (1.0 / t_0) * (x / (x + y));
}
return tmp;
}
def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if y <= 3.8e-85: tmp = (y / (x + y)) / (x + 1.0) elif y <= 5e+146: tmp = x / ((x + y) * t_0) else: tmp = (1.0 / t_0) * (x / (x + y)) return tmp
function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (y <= 3.8e-85) tmp = Float64(Float64(y / Float64(x + y)) / Float64(x + 1.0)); elseif (y <= 5e+146) tmp = Float64(x / Float64(Float64(x + y) * t_0)); else tmp = Float64(Float64(1.0 / t_0) * Float64(x / Float64(x + y))); end return tmp end
function tmp_2 = code(x, y) t_0 = y + (x + 1.0); tmp = 0.0; if (y <= 3.8e-85) tmp = (y / (x + y)) / (x + 1.0); elseif (y <= 5e+146) tmp = x / ((x + y) * t_0); else tmp = (1.0 / t_0) * (x / (x + y)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 3.8e-85], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5e+146], N[(x / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;y \leq 3.8 \cdot 10^{-85}:\\
\;\;\;\;\frac{\frac{y}{x + y}}{x + 1}\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+146}:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_0} \cdot \frac{x}{x + y}\\
\end{array}
\end{array}
if y < 3.7999999999999999e-85Initial program 64.0%
Taylor expanded in x around inf 61.1%
Taylor expanded in x around inf 44.1%
times-frac60.6%
+-commutative60.6%
*-commutative60.6%
Applied egg-rr60.6%
associate-*r/60.6%
associate-/r*63.4%
*-inverses63.4%
*-commutative63.4%
associate-*r/63.5%
associate-*l/63.5%
*-rgt-identity63.5%
Simplified63.5%
if 3.7999999999999999e-85 < y < 4.9999999999999999e146Initial program 69.2%
+-commutative69.2%
+-commutative69.2%
+-commutative69.2%
*-commutative69.2%
distribute-rgt1-in62.3%
fma-define69.2%
+-commutative69.2%
+-commutative69.2%
cube-unmult69.3%
+-commutative69.3%
Simplified69.3%
*-commutative69.3%
fma-define62.4%
cube-mult62.3%
distribute-rgt1-in69.2%
*-commutative69.2%
associate-*l*69.2%
times-frac92.2%
associate-+r+92.2%
Applied egg-rr92.2%
associate-*r/92.3%
+-commutative92.3%
+-commutative92.3%
+-commutative92.3%
associate-+l+92.3%
+-commutative92.3%
Applied egg-rr92.3%
Taylor expanded in y around inf 71.0%
if 4.9999999999999999e146 < y Initial program 66.7%
+-commutative66.7%
+-commutative66.7%
+-commutative66.7%
*-commutative66.7%
distribute-rgt1-in66.7%
fma-define66.7%
+-commutative66.7%
+-commutative66.7%
cube-unmult66.7%
+-commutative66.7%
Simplified66.7%
*-commutative66.7%
fma-define66.7%
cube-mult66.7%
distribute-rgt1-in66.7%
*-commutative66.7%
associate-*l*66.7%
times-frac84.5%
associate-+r+84.5%
Applied egg-rr84.5%
*-un-lft-identity84.5%
*-commutative84.5%
+-commutative84.5%
associate-+l+84.5%
times-frac99.8%
+-commutative99.8%
+-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 93.4%
Final simplification68.6%
(FPCore (x y) :precision binary64 (if (<= y 5e-85) (/ (/ y (+ x y)) (+ x 1.0)) (if (<= y 7.2e+143) (/ x (* (+ x y) (+ y (+ x 1.0)))) (/ (/ x y) (+ x y)))))
double code(double x, double y) {
double tmp;
if (y <= 5e-85) {
tmp = (y / (x + y)) / (x + 1.0);
} else if (y <= 7.2e+143) {
tmp = x / ((x + y) * (y + (x + 1.0)));
} else {
tmp = (x / y) / (x + y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 5d-85) then
tmp = (y / (x + y)) / (x + 1.0d0)
else if (y <= 7.2d+143) then
tmp = x / ((x + y) * (y + (x + 1.0d0)))
else
tmp = (x / y) / (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 5e-85) {
tmp = (y / (x + y)) / (x + 1.0);
} else if (y <= 7.2e+143) {
tmp = x / ((x + y) * (y + (x + 1.0)));
} else {
tmp = (x / y) / (x + y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 5e-85: tmp = (y / (x + y)) / (x + 1.0) elif y <= 7.2e+143: tmp = x / ((x + y) * (y + (x + 1.0))) else: tmp = (x / y) / (x + y) return tmp
function code(x, y) tmp = 0.0 if (y <= 5e-85) tmp = Float64(Float64(y / Float64(x + y)) / Float64(x + 1.0)); elseif (y <= 7.2e+143) tmp = Float64(x / Float64(Float64(x + y) * Float64(y + Float64(x + 1.0)))); else tmp = Float64(Float64(x / y) / Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 5e-85) tmp = (y / (x + y)) / (x + 1.0); elseif (y <= 7.2e+143) tmp = x / ((x + y) * (y + (x + 1.0))); else tmp = (x / y) / (x + y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 5e-85], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.2e+143], N[(x / N[(N[(x + y), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5 \cdot 10^{-85}:\\
\;\;\;\;\frac{\frac{y}{x + y}}{x + 1}\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{+143}:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{x + y}\\
\end{array}
\end{array}
if y < 5.0000000000000002e-85Initial program 64.0%
Taylor expanded in x around inf 61.1%
Taylor expanded in x around inf 44.1%
times-frac60.6%
+-commutative60.6%
*-commutative60.6%
Applied egg-rr60.6%
associate-*r/60.6%
associate-/r*63.4%
*-inverses63.4%
*-commutative63.4%
associate-*r/63.5%
associate-*l/63.5%
*-rgt-identity63.5%
Simplified63.5%
if 5.0000000000000002e-85 < y < 7.1999999999999998e143Initial program 70.5%
+-commutative70.5%
+-commutative70.5%
+-commutative70.5%
*-commutative70.5%
distribute-rgt1-in63.5%
fma-define70.5%
+-commutative70.5%
+-commutative70.5%
cube-unmult70.6%
+-commutative70.6%
Simplified70.6%
*-commutative70.6%
fma-define63.6%
cube-mult63.5%
distribute-rgt1-in70.5%
*-commutative70.5%
associate-*l*70.5%
times-frac93.8%
associate-+r+93.8%
Applied egg-rr93.8%
associate-*r/93.9%
+-commutative93.9%
+-commutative93.9%
+-commutative93.9%
associate-+l+93.9%
+-commutative93.9%
Applied egg-rr93.9%
Taylor expanded in y around inf 72.2%
if 7.1999999999999998e143 < y Initial program 64.5%
+-commutative64.5%
+-commutative64.5%
+-commutative64.5%
*-commutative64.5%
distribute-rgt1-in64.5%
fma-define64.5%
+-commutative64.5%
+-commutative64.5%
cube-unmult64.5%
+-commutative64.5%
Simplified64.5%
*-commutative64.5%
fma-define64.5%
cube-mult64.5%
distribute-rgt1-in64.5%
*-commutative64.5%
associate-*l*64.5%
times-frac82.0%
associate-+r+82.0%
Applied egg-rr82.0%
associate-*r/82.0%
+-commutative82.0%
+-commutative82.0%
+-commutative82.0%
associate-+l+82.0%
+-commutative82.0%
Applied egg-rr82.0%
*-un-lft-identity82.0%
times-frac99.7%
*-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.8%
*-lft-identity99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 90.7%
Final simplification68.6%
(FPCore (x y) :precision binary64 (if (<= y -2.8e-143) (/ y (* x x)) (if (<= y 5.5e-118) (/ y x) (if (<= y 1.0) (/ x y) (/ x (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= -2.8e-143) {
tmp = y / (x * x);
} else if (y <= 5.5e-118) {
tmp = y / x;
} else 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 <= (-2.8d-143)) then
tmp = y / (x * x)
else if (y <= 5.5d-118) then
tmp = y / x
else 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 <= -2.8e-143) {
tmp = y / (x * x);
} else if (y <= 5.5e-118) {
tmp = y / x;
} else if (y <= 1.0) {
tmp = x / y;
} else {
tmp = x / (y * y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.8e-143: tmp = y / (x * x) elif y <= 5.5e-118: tmp = y / x elif y <= 1.0: tmp = x / y else: tmp = x / (y * y) return tmp
function code(x, y) tmp = 0.0 if (y <= -2.8e-143) tmp = Float64(y / Float64(x * x)); elseif (y <= 5.5e-118) tmp = Float64(y / x); elseif (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 <= -2.8e-143) tmp = y / (x * x); elseif (y <= 5.5e-118) tmp = y / x; elseif (y <= 1.0) tmp = x / y; else tmp = x / (y * y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.8e-143], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.5e-118], N[(y / x), $MachinePrecision], 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 -2.8 \cdot 10^{-143}:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-118}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot y}\\
\end{array}
\end{array}
if y < -2.7999999999999999e-143Initial program 61.9%
associate-/l*82.8%
associate-+l+82.8%
Simplified82.8%
Taylor expanded in y around 0 40.8%
+-commutative40.8%
Simplified40.8%
Taylor expanded in x around inf 38.0%
if -2.7999999999999999e-143 < y < 5.5000000000000003e-118Initial program 63.7%
associate-/l*81.1%
associate-+l+81.1%
Simplified81.1%
Taylor expanded in y around 0 84.5%
+-commutative84.5%
Simplified84.5%
Taylor expanded in x around 0 70.2%
if 5.5000000000000003e-118 < y < 1Initial program 75.0%
associate-/l*81.9%
associate-+l+81.9%
Simplified81.9%
Taylor expanded in x around 0 34.0%
Taylor expanded in y around 0 34.0%
if 1 < y Initial program 67.6%
associate-/l*79.7%
associate-+l+79.7%
Simplified79.7%
Taylor expanded in x around 0 75.1%
Taylor expanded in y around inf 75.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (* y y))))
(if (<= y -4e+50)
t_0
(if (<= y 4.2e-115) (/ y x) (if (<= y 1.0) (/ x y) t_0)))))
double code(double x, double y) {
double t_0 = x / (y * y);
double tmp;
if (y <= -4e+50) {
tmp = t_0;
} else if (y <= 4.2e-115) {
tmp = y / x;
} else if (y <= 1.0) {
tmp = x / y;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x / (y * y)
if (y <= (-4d+50)) then
tmp = t_0
else if (y <= 4.2d-115) then
tmp = y / x
else if (y <= 1.0d0) then
tmp = x / y
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (y * y);
double tmp;
if (y <= -4e+50) {
tmp = t_0;
} else if (y <= 4.2e-115) {
tmp = y / x;
} else if (y <= 1.0) {
tmp = x / y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x / (y * y) tmp = 0 if y <= -4e+50: tmp = t_0 elif y <= 4.2e-115: tmp = y / x elif y <= 1.0: tmp = x / y else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x / Float64(y * y)) tmp = 0.0 if (y <= -4e+50) tmp = t_0; elseif (y <= 4.2e-115) tmp = Float64(y / x); elseif (y <= 1.0) tmp = Float64(x / y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (y * y); tmp = 0.0; if (y <= -4e+50) tmp = t_0; elseif (y <= 4.2e-115) tmp = y / x; elseif (y <= 1.0) tmp = x / y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4e+50], t$95$0, If[LessEqual[y, 4.2e-115], N[(y / x), $MachinePrecision], If[LessEqual[y, 1.0], N[(x / y), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{y \cdot y}\\
\mathbf{if}\;y \leq -4 \cdot 10^{+50}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-115}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -4.0000000000000003e50 or 1 < y Initial program 57.5%
associate-/l*78.9%
associate-+l+78.9%
Simplified78.9%
Taylor expanded in x around 0 71.8%
Taylor expanded in y around inf 71.8%
if -4.0000000000000003e50 < y < 4.20000000000000003e-115Initial program 71.6%
associate-/l*84.1%
associate-+l+84.1%
Simplified84.1%
Taylor expanded in y around 0 79.9%
+-commutative79.9%
Simplified79.9%
Taylor expanded in x around 0 58.6%
if 4.20000000000000003e-115 < y < 1Initial program 75.0%
associate-/l*81.9%
associate-+l+81.9%
Simplified81.9%
Taylor expanded in x around 0 34.0%
Taylor expanded in y around 0 34.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (+ x y))))
(if (<= y 1.35e-24)
(/ (/ (* x t_0) (+ x y)) (+ x 1.0))
(/ (* x (/ t_0 (+ x y))) (+ x y)))))
double code(double x, double y) {
double t_0 = y / (x + y);
double tmp;
if (y <= 1.35e-24) {
tmp = ((x * t_0) / (x + y)) / (x + 1.0);
} else {
tmp = (x * (t_0 / (x + y))) / (x + y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y / (x + y)
if (y <= 1.35d-24) then
tmp = ((x * t_0) / (x + y)) / (x + 1.0d0)
else
tmp = (x * (t_0 / (x + y))) / (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y / (x + y);
double tmp;
if (y <= 1.35e-24) {
tmp = ((x * t_0) / (x + y)) / (x + 1.0);
} else {
tmp = (x * (t_0 / (x + y))) / (x + y);
}
return tmp;
}
def code(x, y): t_0 = y / (x + y) tmp = 0 if y <= 1.35e-24: tmp = ((x * t_0) / (x + y)) / (x + 1.0) else: tmp = (x * (t_0 / (x + y))) / (x + y) return tmp
function code(x, y) t_0 = Float64(y / Float64(x + y)) tmp = 0.0 if (y <= 1.35e-24) tmp = Float64(Float64(Float64(x * t_0) / Float64(x + y)) / Float64(x + 1.0)); else tmp = Float64(Float64(x * Float64(t_0 / Float64(x + y))) / Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) t_0 = y / (x + y); tmp = 0.0; if (y <= 1.35e-24) tmp = ((x * t_0) / (x + y)) / (x + 1.0); else tmp = (x * (t_0 / (x + y))) / (x + y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.35e-24], N[(N[(N[(x * t$95$0), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(t$95$0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{x + y}\\
\mathbf{if}\;y \leq 1.35 \cdot 10^{-24}:\\
\;\;\;\;\frac{\frac{x \cdot t\_0}{x + y}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{t\_0}{x + y}}{x + y}\\
\end{array}
\end{array}
if y < 1.35000000000000003e-24Initial program 64.9%
Taylor expanded in x around inf 62.2%
*-commutative62.2%
associate-*l*62.2%
times-frac88.4%
+-commutative88.4%
+-commutative88.4%
Applied egg-rr88.4%
associate-*r/88.4%
associate-/r*87.1%
*-commutative87.1%
div-inv87.0%
div-inv87.1%
+-commutative87.1%
+-commutative87.1%
Applied egg-rr87.1%
if 1.35000000000000003e-24 < y Initial program 66.9%
+-commutative66.9%
+-commutative66.9%
+-commutative66.9%
*-commutative66.9%
distribute-rgt1-in63.0%
fma-define66.9%
+-commutative66.9%
+-commutative66.9%
cube-unmult66.9%
+-commutative66.9%
Simplified66.9%
*-commutative66.9%
fma-define63.0%
cube-mult63.0%
distribute-rgt1-in66.9%
*-commutative66.9%
associate-*l*66.9%
times-frac87.2%
associate-+r+87.2%
Applied egg-rr87.2%
associate-*r/87.3%
+-commutative87.3%
+-commutative87.3%
+-commutative87.3%
associate-+l+87.3%
+-commutative87.3%
Applied egg-rr87.3%
*-un-lft-identity87.3%
times-frac99.8%
*-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-lft-identity99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around inf 99.7%
Final simplification90.5%
(FPCore (x y) :precision binary64 (if (<= x -1.0) (/ y (* x x)) (if (<= x -1.04e-147) (/ y x) (/ x (* y (+ y 1.0))))))
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = y / (x * x);
} else if (x <= -1.04e-147) {
tmp = y / 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 <= (-1.0d0)) then
tmp = y / (x * x)
else if (x <= (-1.04d-147)) then
tmp = y / 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 <= -1.0) {
tmp = y / (x * x);
} else if (x <= -1.04e-147) {
tmp = y / x;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.0: tmp = y / (x * x) elif x <= -1.04e-147: tmp = y / x else: tmp = x / (y * (y + 1.0)) return tmp
function code(x, y) tmp = 0.0 if (x <= -1.0) tmp = Float64(y / Float64(x * x)); elseif (x <= -1.04e-147) tmp = Float64(y / 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 <= -1.0) tmp = y / (x * x); elseif (x <= -1.04e-147) tmp = y / x; else tmp = x / (y * (y + 1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.0], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.04e-147], N[(y / x), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{elif}\;x \leq -1.04 \cdot 10^{-147}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -1Initial program 64.6%
associate-/l*76.2%
associate-+l+76.2%
Simplified76.2%
Taylor expanded in y around 0 70.1%
+-commutative70.1%
Simplified70.1%
Taylor expanded in x around inf 68.2%
if -1 < x < -1.04000000000000003e-147Initial program 78.3%
associate-/l*99.5%
associate-+l+99.5%
Simplified99.5%
Taylor expanded in y around 0 49.4%
+-commutative49.4%
Simplified49.4%
Taylor expanded in x around 0 49.4%
if -1.04000000000000003e-147 < x Initial program 63.2%
associate-/l*80.2%
associate-+l+80.2%
Simplified80.2%
Taylor expanded in x around 0 56.4%
Final simplification58.8%
(FPCore (x y) :precision binary64 (* (/ (/ y (+ x y)) (+ x y)) (/ x (+ y (+ x 1.0)))))
double code(double x, double y) {
return ((y / (x + y)) / (x + y)) * (x / (y + (x + 1.0)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((y / (x + y)) / (x + y)) * (x / (y + (x + 1.0d0)))
end function
public static double code(double x, double y) {
return ((y / (x + y)) / (x + y)) * (x / (y + (x + 1.0)));
}
def code(x, y): return ((y / (x + y)) / (x + y)) * (x / (y + (x + 1.0)))
function code(x, y) return Float64(Float64(Float64(y / Float64(x + y)) / Float64(x + y)) * Float64(x / Float64(y + Float64(x + 1.0)))) end
function tmp = code(x, y) tmp = ((y / (x + y)) / (x + y)) * (x / (y + (x + 1.0))); end
code[x_, y_] := N[(N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{y}{x + y}}{x + y} \cdot \frac{x}{y + \left(x + 1\right)}
\end{array}
Initial program 65.4%
+-commutative65.4%
+-commutative65.4%
+-commutative65.4%
*-commutative65.4%
distribute-rgt1-in53.8%
fma-define65.4%
+-commutative65.4%
+-commutative65.4%
cube-unmult65.4%
+-commutative65.4%
Simplified65.4%
*-commutative65.4%
fma-define53.8%
cube-mult53.8%
distribute-rgt1-in65.4%
*-commutative65.4%
associate-*l*65.4%
times-frac93.0%
associate-+r+93.0%
Applied egg-rr93.0%
associate-*r/93.0%
+-commutative93.0%
+-commutative93.0%
+-commutative93.0%
associate-+l+93.0%
+-commutative93.0%
Applied egg-rr93.0%
times-frac99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y) :precision binary64 (if (<= y 1.52e-83) (/ (/ y (+ x y)) (+ x 1.0)) (/ (/ x (+ y 1.0)) (+ x y))))
double code(double x, double y) {
double tmp;
if (y <= 1.52e-83) {
tmp = (y / (x + y)) / (x + 1.0);
} else {
tmp = (x / (y + 1.0)) / (x + y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.52d-83) then
tmp = (y / (x + y)) / (x + 1.0d0)
else
tmp = (x / (y + 1.0d0)) / (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.52e-83) {
tmp = (y / (x + y)) / (x + 1.0);
} else {
tmp = (x / (y + 1.0)) / (x + y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.52e-83: tmp = (y / (x + y)) / (x + 1.0) else: tmp = (x / (y + 1.0)) / (x + y) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.52e-83) tmp = Float64(Float64(y / Float64(x + y)) / Float64(x + 1.0)); else tmp = Float64(Float64(x / Float64(y + 1.0)) / Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.52e-83) tmp = (y / (x + y)) / (x + 1.0); else tmp = (x / (y + 1.0)) / (x + y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.52e-83], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.52 \cdot 10^{-83}:\\
\;\;\;\;\frac{\frac{y}{x + y}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{x + y}\\
\end{array}
\end{array}
if y < 1.51999999999999994e-83Initial program 64.0%
Taylor expanded in x around inf 61.1%
Taylor expanded in x around inf 44.1%
times-frac60.6%
+-commutative60.6%
*-commutative60.6%
Applied egg-rr60.6%
associate-*r/60.6%
associate-/r*63.4%
*-inverses63.4%
*-commutative63.4%
associate-*r/63.5%
associate-*l/63.5%
*-rgt-identity63.5%
Simplified63.5%
if 1.51999999999999994e-83 < y Initial program 68.3%
+-commutative68.3%
+-commutative68.3%
+-commutative68.3%
*-commutative68.3%
distribute-rgt1-in63.9%
fma-define68.3%
+-commutative68.3%
+-commutative68.3%
cube-unmult68.3%
+-commutative68.3%
Simplified68.3%
*-commutative68.3%
fma-define63.9%
cube-mult63.9%
distribute-rgt1-in68.3%
*-commutative68.3%
associate-*l*68.3%
times-frac89.4%
associate-+r+89.4%
Applied egg-rr89.4%
associate-*r/89.5%
+-commutative89.5%
+-commutative89.5%
+-commutative89.5%
associate-+l+89.5%
+-commutative89.5%
Applied egg-rr89.5%
*-un-lft-identity89.5%
times-frac99.7%
*-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.8%
*-lft-identity99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 67.9%
Final simplification65.0%
(FPCore (x y) :precision binary64 (if (<= y 7.8e-85) (/ y (* x (+ x 1.0))) (/ (/ x (+ y 1.0)) (+ x y))))
double code(double x, double y) {
double tmp;
if (y <= 7.8e-85) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / (y + 1.0)) / (x + y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 7.8d-85) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / (y + 1.0d0)) / (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 7.8e-85) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / (y + 1.0)) / (x + y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 7.8e-85: tmp = y / (x * (x + 1.0)) else: tmp = (x / (y + 1.0)) / (x + y) return tmp
function code(x, y) tmp = 0.0 if (y <= 7.8e-85) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / Float64(y + 1.0)) / Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 7.8e-85) tmp = y / (x * (x + 1.0)); else tmp = (x / (y + 1.0)) / (x + y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 7.8e-85], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.8 \cdot 10^{-85}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{x + y}\\
\end{array}
\end{array}
if y < 7.79999999999999977e-85Initial program 64.0%
associate-/l*82.3%
associate-+l+82.3%
Simplified82.3%
Taylor expanded in y around 0 62.8%
+-commutative62.8%
Simplified62.8%
if 7.79999999999999977e-85 < y Initial program 68.3%
+-commutative68.3%
+-commutative68.3%
+-commutative68.3%
*-commutative68.3%
distribute-rgt1-in63.9%
fma-define68.3%
+-commutative68.3%
+-commutative68.3%
cube-unmult68.3%
+-commutative68.3%
Simplified68.3%
*-commutative68.3%
fma-define63.9%
cube-mult63.9%
distribute-rgt1-in68.3%
*-commutative68.3%
associate-*l*68.3%
times-frac89.4%
associate-+r+89.4%
Applied egg-rr89.4%
associate-*r/89.5%
+-commutative89.5%
+-commutative89.5%
+-commutative89.5%
associate-+l+89.5%
+-commutative89.5%
Applied egg-rr89.5%
*-un-lft-identity89.5%
times-frac99.7%
*-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.8%
*-lft-identity99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 67.9%
Final simplification64.5%
(FPCore (x y) :precision binary64 (if (<= y 4.2e-83) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
double code(double x, double y) {
double tmp;
if (y <= 4.2e-83) {
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.2d-83) 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.2e-83) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 4.2e-83: 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.2e-83) 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 <= 4.2e-83) 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.2e-83], 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 4.2 \cdot 10^{-83}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if y < 4.1999999999999998e-83Initial program 64.0%
associate-/l*82.3%
associate-+l+82.3%
Simplified82.3%
Taylor expanded in y around 0 62.8%
+-commutative62.8%
Simplified62.8%
if 4.1999999999999998e-83 < y Initial program 68.3%
associate-/l*79.5%
associate-+l+79.5%
Simplified79.5%
Taylor expanded in x around 0 64.2%
associate-/r*67.4%
+-commutative67.4%
Simplified67.4%
(FPCore (x y) :precision binary64 (if (<= y 4.2e-83) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= 4.2e-83) {
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.2d-83) 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.2e-83) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 4.2e-83: 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.2e-83) 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 <= 4.2e-83) 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.2e-83], 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 4.2 \cdot 10^{-83}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 4.1999999999999998e-83Initial program 64.0%
associate-/l*82.3%
associate-+l+82.3%
Simplified82.3%
Taylor expanded in y around 0 62.8%
+-commutative62.8%
Simplified62.8%
if 4.1999999999999998e-83 < y Initial program 68.3%
associate-/l*79.5%
associate-+l+79.5%
Simplified79.5%
Taylor expanded in x around 0 64.2%
Final simplification63.3%
(FPCore (x y) :precision binary64 (if (<= x -1.04e-147) (/ y x) (/ 1.0 (/ y x))))
double code(double x, double y) {
double tmp;
if (x <= -1.04e-147) {
tmp = y / x;
} else {
tmp = 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.04d-147)) then
tmp = y / x
else
tmp = 1.0d0 / (y / x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.04e-147) {
tmp = y / x;
} else {
tmp = 1.0 / (y / x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.04e-147: tmp = y / x else: tmp = 1.0 / (y / x) return tmp
function code(x, y) tmp = 0.0 if (x <= -1.04e-147) tmp = Float64(y / x); else tmp = Float64(1.0 / Float64(y / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.04e-147) tmp = y / x; else tmp = 1.0 / (y / x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.04e-147], N[(y / x), $MachinePrecision], N[(1.0 / N[(y / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.04 \cdot 10^{-147}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{y}{x}}\\
\end{array}
\end{array}
if x < -1.04000000000000003e-147Initial program 68.8%
associate-/l*83.3%
associate-+l+83.3%
Simplified83.3%
Taylor expanded in y around 0 63.8%
+-commutative63.8%
Simplified63.8%
Taylor expanded in x around 0 35.3%
if -1.04000000000000003e-147 < x Initial program 63.2%
associate-/l*80.2%
associate-+l+80.2%
Simplified80.2%
Taylor expanded in x around 0 56.4%
Taylor expanded in y around 0 37.3%
clear-num38.7%
inv-pow38.7%
Applied egg-rr38.7%
unpow-138.7%
Simplified38.7%
(FPCore (x y) :precision binary64 (if (<= x -1.04e-147) (/ y x) (/ x y)))
double code(double x, double y) {
double tmp;
if (x <= -1.04e-147) {
tmp = y / x;
} 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 <= (-1.04d-147)) then
tmp = y / x
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.04e-147) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.04e-147: tmp = y / x else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if (x <= -1.04e-147) tmp = Float64(y / x); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.04e-147) tmp = y / x; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.04e-147], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.04 \cdot 10^{-147}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -1.04000000000000003e-147Initial program 68.8%
associate-/l*83.3%
associate-+l+83.3%
Simplified83.3%
Taylor expanded in y around 0 63.8%
+-commutative63.8%
Simplified63.8%
Taylor expanded in x around 0 35.3%
if -1.04000000000000003e-147 < x Initial program 63.2%
associate-/l*80.2%
associate-+l+80.2%
Simplified80.2%
Taylor expanded in x around 0 56.4%
Taylor expanded in y around 0 37.3%
(FPCore (x y) :precision binary64 (/ x y))
double code(double x, double y) {
return x / y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / y
end function
public static double code(double x, double y) {
return x / y;
}
def code(x, y): return x / y
function code(x, y) return Float64(x / y) end
function tmp = code(x, y) tmp = x / y; end
code[x_, y_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y}
\end{array}
Initial program 65.4%
associate-/l*81.4%
associate-+l+81.4%
Simplified81.4%
Taylor expanded in x around 0 46.7%
Taylor expanded in y around 0 25.7%
(FPCore (x y) :precision binary64 1.0)
double code(double x, double y) {
return 1.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0
end function
public static double code(double x, double y) {
return 1.0;
}
def code(x, y): return 1.0
function code(x, y) return 1.0 end
function tmp = code(x, y) tmp = 1.0; end
code[x_, y_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 65.4%
Taylor expanded in x around inf 57.9%
Taylor expanded in x around inf 36.1%
Taylor expanded in x around 0 3.4%
(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 2024151
(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))))