
(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 15 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)) (+ y (+ x 1.0)))))
double code(double x, double y) {
return (x / (x + y)) * ((y / (x + y)) / (y + (x + 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)) / (y + (x + 1.0d0)))
end function
public static double code(double x, double y) {
return (x / (x + y)) * ((y / (x + y)) / (y + (x + 1.0)));
}
def code(x, y): return (x / (x + y)) * ((y / (x + y)) / (y + (x + 1.0)))
function code(x, y) return Float64(Float64(x / Float64(x + y)) * Float64(Float64(y / Float64(x + y)) / Float64(y + Float64(x + 1.0)))) end
function tmp = code(x, y) tmp = (x / (x + y)) * ((y / (x + y)) / (y + (x + 1.0))); end
code[x_, y_] := N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{x + y} \cdot \frac{\frac{y}{x + y}}{y + \left(x + 1\right)}
\end{array}
Initial program 67.8%
associate-*l*67.8%
times-frac92.1%
+-commutative92.1%
+-commutative92.1%
associate-+r+92.1%
+-commutative92.1%
associate-+l+92.1%
Applied egg-rr92.1%
*-un-lft-identity92.1%
+-commutative92.1%
Applied egg-rr92.1%
*-lft-identity92.1%
associate-/r*99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (/ y (+ x y)) (+ y (+ x 1.0)))))
(if (<= y 2.8e-199)
t_0
(if (<= y 4.6e+98)
(* x (/ y (* (* (+ x y) (+ x y)) (+ x (+ y 1.0)))))
(* t_0 (/ x y))))))
double code(double x, double y) {
double t_0 = (y / (x + y)) / (y + (x + 1.0));
double tmp;
if (y <= 2.8e-199) {
tmp = t_0;
} else if (y <= 4.6e+98) {
tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0))));
} else {
tmp = t_0 * (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)) / (y + (x + 1.0d0))
if (y <= 2.8d-199) then
tmp = t_0
else if (y <= 4.6d+98) then
tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0d0))))
else
tmp = t_0 * (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y / (x + y)) / (y + (x + 1.0));
double tmp;
if (y <= 2.8e-199) {
tmp = t_0;
} else if (y <= 4.6e+98) {
tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0))));
} else {
tmp = t_0 * (x / y);
}
return tmp;
}
def code(x, y): t_0 = (y / (x + y)) / (y + (x + 1.0)) tmp = 0 if y <= 2.8e-199: tmp = t_0 elif y <= 4.6e+98: tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0)))) else: tmp = t_0 * (x / y) return tmp
function code(x, y) t_0 = Float64(Float64(y / Float64(x + y)) / Float64(y + Float64(x + 1.0))) tmp = 0.0 if (y <= 2.8e-199) tmp = t_0; elseif (y <= 4.6e+98) tmp = Float64(x * Float64(y / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(x + Float64(y + 1.0))))); else tmp = Float64(t_0 * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) t_0 = (y / (x + y)) / (y + (x + 1.0)); tmp = 0.0; if (y <= 2.8e-199) tmp = t_0; elseif (y <= 4.6e+98) tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0)))); else tmp = t_0 * (x / y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 2.8e-199], t$95$0, If[LessEqual[y, 4.6e+98], N[(x * N[(y / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(x / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{y}{x + y}}{y + \left(x + 1\right)}\\
\mathbf{if}\;y \leq 2.8 \cdot 10^{-199}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{+98}:\\
\;\;\;\;x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < 2.80000000000000018e-199Initial program 66.4%
associate-*l*66.5%
times-frac92.7%
+-commutative92.7%
+-commutative92.7%
associate-+r+92.7%
+-commutative92.7%
associate-+l+92.7%
Applied egg-rr92.7%
*-un-lft-identity92.7%
+-commutative92.7%
Applied egg-rr92.7%
*-lft-identity92.7%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in x around inf 56.7%
if 2.80000000000000018e-199 < y < 4.60000000000000026e98Initial program 88.9%
associate-/l*93.0%
associate-+l+93.0%
Simplified93.0%
if 4.60000000000000026e98 < y Initial program 47.3%
associate-*l*47.3%
times-frac83.3%
+-commutative83.3%
+-commutative83.3%
associate-+r+83.3%
+-commutative83.3%
associate-+l+83.3%
Applied egg-rr83.3%
*-un-lft-identity83.3%
+-commutative83.3%
Applied egg-rr83.3%
*-lft-identity83.3%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in x around 0 86.7%
Final simplification70.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))) (t_1 (/ (/ y (+ x y)) t_0)))
(if (<= y -4e+88)
(* t_1 (- 1.0 (/ y x)))
(if (<= y 1.4e+124)
(* (/ x (+ x y)) (/ y (* (+ x y) t_0)))
(* t_1 (/ x y))))))
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double t_1 = (y / (x + y)) / t_0;
double tmp;
if (y <= -4e+88) {
tmp = t_1 * (1.0 - (y / x));
} else if (y <= 1.4e+124) {
tmp = (x / (x + y)) * (y / ((x + y) * t_0));
} else {
tmp = t_1 * (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) :: t_1
real(8) :: tmp
t_0 = y + (x + 1.0d0)
t_1 = (y / (x + y)) / t_0
if (y <= (-4d+88)) then
tmp = t_1 * (1.0d0 - (y / x))
else if (y <= 1.4d+124) then
tmp = (x / (x + y)) * (y / ((x + y) * t_0))
else
tmp = t_1 * (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y + (x + 1.0);
double t_1 = (y / (x + y)) / t_0;
double tmp;
if (y <= -4e+88) {
tmp = t_1 * (1.0 - (y / x));
} else if (y <= 1.4e+124) {
tmp = (x / (x + y)) * (y / ((x + y) * t_0));
} else {
tmp = t_1 * (x / y);
}
return tmp;
}
def code(x, y): t_0 = y + (x + 1.0) t_1 = (y / (x + y)) / t_0 tmp = 0 if y <= -4e+88: tmp = t_1 * (1.0 - (y / x)) elif y <= 1.4e+124: tmp = (x / (x + y)) * (y / ((x + y) * t_0)) else: tmp = t_1 * (x / y) return tmp
function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) t_1 = Float64(Float64(y / Float64(x + y)) / t_0) tmp = 0.0 if (y <= -4e+88) tmp = Float64(t_1 * Float64(1.0 - Float64(y / x))); elseif (y <= 1.4e+124) tmp = Float64(Float64(x / Float64(x + y)) * Float64(y / Float64(Float64(x + y) * t_0))); else tmp = Float64(t_1 * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) t_0 = y + (x + 1.0); t_1 = (y / (x + y)) / t_0; tmp = 0.0; if (y <= -4e+88) tmp = t_1 * (1.0 - (y / x)); elseif (y <= 1.4e+124) tmp = (x / (x + y)) * (y / ((x + y) * t_0)); else tmp = t_1 * (x / y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]}, If[LessEqual[y, -4e+88], N[(t$95$1 * N[(1.0 - N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e+124], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(y / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(x / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
t_1 := \frac{\frac{y}{x + y}}{t\_0}\\
\mathbf{if}\;y \leq -4 \cdot 10^{+88}:\\
\;\;\;\;t\_1 \cdot \left(1 - \frac{y}{x}\right)\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+124}:\\
\;\;\;\;\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < -3.99999999999999984e88Initial program 53.5%
associate-*l*53.5%
times-frac79.7%
+-commutative79.7%
+-commutative79.7%
associate-+r+79.7%
+-commutative79.7%
associate-+l+79.7%
Applied egg-rr79.7%
*-un-lft-identity79.7%
+-commutative79.7%
Applied egg-rr79.7%
*-lft-identity79.7%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in x around inf 16.9%
mul-1-neg16.9%
unsub-neg16.9%
Simplified16.9%
if -3.99999999999999984e88 < y < 1.4e124Initial program 77.0%
associate-*l*77.1%
times-frac98.1%
+-commutative98.1%
+-commutative98.1%
associate-+r+98.1%
+-commutative98.1%
associate-+l+98.1%
Applied egg-rr98.1%
if 1.4e124 < y Initial program 48.9%
associate-*l*48.9%
times-frac83.1%
+-commutative83.1%
+-commutative83.1%
associate-+r+83.1%
+-commutative83.1%
associate-+l+83.1%
Applied egg-rr83.1%
*-un-lft-identity83.1%
+-commutative83.1%
Applied egg-rr83.1%
*-lft-identity83.1%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in x around 0 89.3%
Final simplification81.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= x -6.5e+86)
(/ (/ y (+ x y)) t_0)
(* x (/ (/ y (* (+ x y) t_0)) (+ x y))))))
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -6.5e+86) {
tmp = (y / (x + y)) / t_0;
} else {
tmp = x * ((y / ((x + y) * t_0)) / (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 (x <= (-6.5d+86)) then
tmp = (y / (x + y)) / t_0
else
tmp = x * ((y / ((x + y) * t_0)) / (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 (x <= -6.5e+86) {
tmp = (y / (x + y)) / t_0;
} else {
tmp = x * ((y / ((x + y) * t_0)) / (x + y));
}
return tmp;
}
def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if x <= -6.5e+86: tmp = (y / (x + y)) / t_0 else: tmp = x * ((y / ((x + y) * t_0)) / (x + y)) return tmp
function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (x <= -6.5e+86) tmp = Float64(Float64(y / Float64(x + y)) / t_0); else tmp = Float64(x * Float64(Float64(y / Float64(Float64(x + y) * t_0)) / Float64(x + y))); end return tmp end
function tmp_2 = code(x, y) t_0 = y + (x + 1.0); tmp = 0.0; if (x <= -6.5e+86) tmp = (y / (x + y)) / t_0; else tmp = x * ((y / ((x + y) * t_0)) / (x + y)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.5e+86], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], N[(x * N[(N[(y / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;x \leq -6.5 \cdot 10^{+86}:\\
\;\;\;\;\frac{\frac{y}{x + y}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{y}{\left(x + y\right) \cdot t\_0}}{x + y}\\
\end{array}
\end{array}
if x < -6.49999999999999996e86Initial program 46.2%
associate-*l*46.2%
times-frac75.0%
+-commutative75.0%
+-commutative75.0%
associate-+r+75.0%
+-commutative75.0%
associate-+l+75.0%
Applied egg-rr75.0%
*-un-lft-identity75.0%
+-commutative75.0%
Applied egg-rr75.0%
*-lft-identity75.0%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in x around inf 81.0%
if -6.49999999999999996e86 < x Initial program 71.9%
associate-/l*82.5%
associate-+l+82.5%
Simplified82.5%
*-un-lft-identity82.5%
associate-+r+82.5%
associate-*l*82.5%
times-frac93.9%
+-commutative93.9%
+-commutative93.9%
associate-+r+93.9%
+-commutative93.9%
associate-+l+93.9%
Applied egg-rr93.9%
associate-*l/93.9%
*-lft-identity93.9%
+-commutative93.9%
Simplified93.9%
Final simplification91.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= x -1.7e+87)
(* (/ (/ y (+ x y)) t_0) (- 1.0 (/ y x)))
(* x (/ (/ y (* (+ x y) t_0)) (+ x y))))))
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (x <= -1.7e+87) {
tmp = ((y / (x + y)) / t_0) * (1.0 - (y / x));
} else {
tmp = x * ((y / ((x + y) * t_0)) / (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 (x <= (-1.7d+87)) then
tmp = ((y / (x + y)) / t_0) * (1.0d0 - (y / x))
else
tmp = x * ((y / ((x + y) * t_0)) / (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 (x <= -1.7e+87) {
tmp = ((y / (x + y)) / t_0) * (1.0 - (y / x));
} else {
tmp = x * ((y / ((x + y) * t_0)) / (x + y));
}
return tmp;
}
def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if x <= -1.7e+87: tmp = ((y / (x + y)) / t_0) * (1.0 - (y / x)) else: tmp = x * ((y / ((x + y) * t_0)) / (x + y)) return tmp
function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (x <= -1.7e+87) tmp = Float64(Float64(Float64(y / Float64(x + y)) / t_0) * Float64(1.0 - Float64(y / x))); else tmp = Float64(x * Float64(Float64(y / Float64(Float64(x + y) * t_0)) / Float64(x + y))); end return tmp end
function tmp_2 = code(x, y) t_0 = y + (x + 1.0); tmp = 0.0; if (x <= -1.7e+87) tmp = ((y / (x + y)) / t_0) * (1.0 - (y / x)); else tmp = x * ((y / ((x + y) * t_0)) / (x + y)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.7e+87], N[(N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] * N[(1.0 - N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;x \leq -1.7 \cdot 10^{+87}:\\
\;\;\;\;\frac{\frac{y}{x + y}}{t\_0} \cdot \left(1 - \frac{y}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{y}{\left(x + y\right) \cdot t\_0}}{x + y}\\
\end{array}
\end{array}
if x < -1.7000000000000001e87Initial program 46.2%
associate-*l*46.2%
times-frac75.0%
+-commutative75.0%
+-commutative75.0%
associate-+r+75.0%
+-commutative75.0%
associate-+l+75.0%
Applied egg-rr75.0%
*-un-lft-identity75.0%
+-commutative75.0%
Applied egg-rr75.0%
*-lft-identity75.0%
associate-/r*99.7%
Simplified99.7%
Taylor expanded in x around inf 82.0%
mul-1-neg82.0%
unsub-neg82.0%
Simplified82.0%
if -1.7000000000000001e87 < x Initial program 71.9%
associate-/l*82.5%
associate-+l+82.5%
Simplified82.5%
*-un-lft-identity82.5%
associate-+r+82.5%
associate-*l*82.5%
times-frac93.9%
+-commutative93.9%
+-commutative93.9%
associate-+r+93.9%
+-commutative93.9%
associate-+l+93.9%
Applied egg-rr93.9%
associate-*l/93.9%
*-lft-identity93.9%
+-commutative93.9%
Simplified93.9%
Final simplification92.0%
(FPCore (x y) :precision binary64 (if (<= y 3.1e-110) (/ (/ y x) (+ x 1.0)) (* (/ (/ y (+ x y)) (+ y (+ x 1.0))) (/ x y))))
double code(double x, double y) {
double tmp;
if (y <= 3.1e-110) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = ((y / (x + y)) / (y + (x + 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 <= 3.1d-110) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = ((y / (x + y)) / (y + (x + 1.0d0))) * (x / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 3.1e-110) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = ((y / (x + y)) / (y + (x + 1.0))) * (x / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 3.1e-110: tmp = (y / x) / (x + 1.0) else: tmp = ((y / (x + y)) / (y + (x + 1.0))) * (x / y) return tmp
function code(x, y) tmp = 0.0 if (y <= 3.1e-110) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(Float64(Float64(y / Float64(x + y)) / Float64(y + Float64(x + 1.0))) * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 3.1e-110) tmp = (y / x) / (x + 1.0); else tmp = ((y / (x + y)) / (y + (x + 1.0))) * (x / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 3.1e-110], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.1 \cdot 10^{-110}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{x + y}}{y + \left(x + 1\right)} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < 3.10000000000000007e-110Initial program 69.2%
associate-/l*80.9%
associate-+l+80.9%
Simplified80.9%
Taylor expanded in y around 0 57.3%
associate-/r*59.0%
+-commutative59.0%
Simplified59.0%
if 3.10000000000000007e-110 < y Initial program 65.0%
associate-*l*65.0%
times-frac89.4%
+-commutative89.4%
+-commutative89.4%
associate-+r+89.4%
+-commutative89.4%
associate-+l+89.4%
Applied egg-rr89.4%
*-un-lft-identity89.4%
+-commutative89.4%
Applied egg-rr89.4%
*-lft-identity89.4%
associate-/r*99.8%
Simplified99.8%
Taylor expanded in x around 0 82.8%
Final simplification67.2%
(FPCore (x y) :precision binary64 (if (<= y 3.3e-107) (/ (/ y x) (+ x 1.0)) (/ x (* (+ x y) (+ y (+ x 1.0))))))
double code(double x, double y) {
double tmp;
if (y <= 3.3e-107) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = x / ((x + y) * (y + (x + 1.0)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 3.3d-107) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = x / ((x + y) * (y + (x + 1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 3.3e-107) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = x / ((x + y) * (y + (x + 1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 3.3e-107: tmp = (y / x) / (x + 1.0) else: tmp = x / ((x + y) * (y + (x + 1.0))) return tmp
function code(x, y) tmp = 0.0 if (y <= 3.3e-107) tmp = Float64(Float64(y / x) / Float64(x + 1.0)); else tmp = Float64(x / Float64(Float64(x + y) * Float64(y + Float64(x + 1.0)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 3.3e-107) tmp = (y / x) / (x + 1.0); else tmp = x / ((x + y) * (y + (x + 1.0))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 3.3e-107], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(x + y), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.3 \cdot 10^{-107}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\end{array}
\end{array}
if y < 3.30000000000000004e-107Initial program 69.4%
associate-/l*81.1%
associate-+l+81.1%
Simplified81.1%
Taylor expanded in y around 0 57.5%
associate-/r*59.3%
+-commutative59.3%
Simplified59.3%
if 3.30000000000000004e-107 < y Initial program 64.6%
associate-*l*64.6%
times-frac89.2%
+-commutative89.2%
+-commutative89.2%
associate-+r+89.2%
+-commutative89.2%
associate-+l+89.2%
Applied egg-rr89.2%
associate-*r/89.2%
+-commutative89.2%
Applied egg-rr89.2%
Taylor expanded in x around 0 79.5%
Final simplification66.2%
(FPCore (x y) :precision binary64 (if (<= y 3e-108) (/ y x) (/ x (* y (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= 3e-108) {
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 (y <= 3d-108) 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 (y <= 3e-108) {
tmp = y / x;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 3e-108: tmp = y / x else: tmp = x / (y * (y + 1.0)) return tmp
function code(x, y) tmp = 0.0 if (y <= 3e-108) 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 (y <= 3e-108) tmp = y / x; else tmp = x / (y * (y + 1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 3e-108], N[(y / x), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3 \cdot 10^{-108}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 2.99999999999999993e-108Initial program 69.4%
associate-/l*81.1%
associate-+l+81.1%
Simplified81.1%
Taylor expanded in y around 0 57.5%
associate-/r*59.3%
+-commutative59.3%
Simplified59.3%
div-inv59.2%
Applied egg-rr59.2%
Taylor expanded in x around 0 39.5%
if 2.99999999999999993e-108 < y Initial program 64.6%
associate-/l*79.2%
associate-+l+79.2%
Simplified79.2%
Taylor expanded in x around 0 69.2%
+-commutative69.2%
Simplified69.2%
Final simplification49.6%
(FPCore (x y) :precision binary64 (if (<= y 8e-107) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= 8e-107) {
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 <= 8d-107) 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 <= 8e-107) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 8e-107: tmp = y / (x * (x + 1.0)) else: tmp = x / (y * (y + 1.0)) return tmp
function code(x, y) tmp = 0.0 if (y <= 8e-107) 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 <= 8e-107) tmp = y / (x * (x + 1.0)); else tmp = x / (y * (y + 1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 8e-107], 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 8 \cdot 10^{-107}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 8e-107Initial program 69.4%
associate-/l*81.1%
associate-+l+81.1%
Simplified81.1%
Taylor expanded in y around 0 57.5%
if 8e-107 < y Initial program 64.6%
associate-/l*79.2%
associate-+l+79.2%
Simplified79.2%
Taylor expanded in x around 0 69.2%
+-commutative69.2%
Simplified69.2%
Final simplification61.5%
(FPCore (x y) :precision binary64 (if (<= y 1.9e-106) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
double code(double x, double y) {
double tmp;
if (y <= 1.9e-106) {
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.9d-106) 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.9e-106) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.9e-106: 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.9e-106) 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.9e-106) 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.9e-106], 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.9 \cdot 10^{-106}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if y < 1.9e-106Initial program 69.4%
associate-/l*81.1%
associate-+l+81.1%
Simplified81.1%
Taylor expanded in y around 0 57.5%
if 1.9e-106 < y Initial program 64.6%
associate-/l*79.2%
associate-+l+79.2%
Simplified79.2%
Taylor expanded in x around 0 69.2%
+-commutative69.2%
div-inv69.2%
associate-/r*65.7%
Applied egg-rr65.7%
Final simplification60.3%
(FPCore (x y) :precision binary64 (if (<= y 1.9e-106) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (+ y 1.0))))
double code(double x, double y) {
double tmp;
if (y <= 1.9e-106) {
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.9d-106) 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.9e-106) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.9e-106: 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.9e-106) 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 <= 1.9e-106) 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.9e-106], 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 1.9 \cdot 10^{-106}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if y < 1.9e-106Initial program 69.4%
associate-/l*81.1%
associate-+l+81.1%
Simplified81.1%
Taylor expanded in y around 0 57.5%
associate-/r*59.3%
+-commutative59.3%
Simplified59.3%
if 1.9e-106 < y Initial program 64.6%
associate-/l*79.2%
associate-+l+79.2%
Simplified79.2%
Taylor expanded in x around 0 69.2%
+-commutative69.2%
div-inv69.2%
associate-/r*65.7%
Applied egg-rr65.7%
Final simplification61.4%
(FPCore (x y) :precision binary64 (if (<= y 9.8e-107) (/ y x) (/ x y)))
double code(double x, double y) {
double tmp;
if (y <= 9.8e-107) {
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 (y <= 9.8d-107) 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 (y <= 9.8e-107) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 9.8e-107: tmp = y / x else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if (y <= 9.8e-107) tmp = Float64(y / x); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 9.8e-107) tmp = y / x; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 9.8e-107], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9.8 \cdot 10^{-107}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if y < 9.79999999999999959e-107Initial program 69.4%
associate-/l*81.1%
associate-+l+81.1%
Simplified81.1%
Taylor expanded in y around 0 57.5%
associate-/r*59.3%
+-commutative59.3%
Simplified59.3%
div-inv59.2%
Applied egg-rr59.2%
Taylor expanded in x around 0 39.5%
if 9.79999999999999959e-107 < y Initial program 64.6%
associate-/l*79.2%
associate-+l+79.2%
Simplified79.2%
Taylor expanded in x around 0 69.2%
+-commutative69.2%
Simplified69.2%
Taylor expanded in y around 0 29.5%
Final simplification36.1%
(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 67.8%
associate-/l*80.4%
associate-+l+80.4%
Simplified80.4%
Taylor expanded in x around 0 50.0%
+-commutative50.0%
Simplified50.0%
Taylor expanded in y around 0 25.0%
Final simplification25.0%
(FPCore (x y) :precision binary64 (- x))
double code(double x, double y) {
return -x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = -x
end function
public static double code(double x, double y) {
return -x;
}
def code(x, y): return -x
function code(x, y) return Float64(-x) end
function tmp = code(x, y) tmp = -x; end
code[x_, y_] := (-x)
\begin{array}{l}
\\
-x
\end{array}
Initial program 67.8%
associate-/l*80.4%
associate-+l+80.4%
Simplified80.4%
Taylor expanded in x around 0 50.0%
Taylor expanded in y around 0 15.0%
neg-mul-115.0%
sub-neg15.0%
Simplified15.0%
Taylor expanded in y around inf 3.7%
neg-mul-13.7%
Simplified3.7%
Final simplification3.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 67.8%
associate-*l*67.8%
times-frac92.1%
+-commutative92.1%
+-commutative92.1%
associate-+r+92.1%
+-commutative92.1%
associate-+l+92.1%
Applied egg-rr92.1%
Taylor expanded in y around 0 48.2%
+-commutative48.2%
Simplified48.2%
Taylor expanded in x around 0 3.3%
Final simplification3.3%
(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 2024055
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
:precision binary64
:alt
(/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))