
(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 13 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 (+ y (+ x 1.0))) (+ x y))))
double code(double x, double y) {
return (x / (x + y)) * ((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 / (x + y)) * ((y / (y + (x + 1.0d0))) / (x + y))
end function
public static double code(double x, double y) {
return (x / (x + y)) * ((y / (y + (x + 1.0))) / (x + y));
}
def code(x, y): return (x / (x + y)) * ((y / (y + (x + 1.0))) / (x + y))
function code(x, y) return Float64(Float64(x / Float64(x + y)) * Float64(Float64(y / Float64(y + Float64(x + 1.0))) / Float64(x + y))) end
function tmp = code(x, y) tmp = (x / (x + y)) * ((y / (y + (x + 1.0))) / (x + y)); end
code[x_, y_] := N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{x + y} \cdot \frac{\frac{y}{y + \left(x + 1\right)}}{x + y}
\end{array}
Initial program 66.7%
associate-*l*66.7%
times-frac95.7%
+-commutative95.7%
+-commutative95.7%
associate-+r+95.7%
+-commutative95.7%
associate-+l+95.7%
Applied egg-rr95.7%
*-un-lft-identity95.7%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.9%
*-lft-identity99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= y -1.8e-48)
(/ y (* (+ x y) t_0))
(if (<= y 5.4e+133)
(* x (/ (/ (/ y (+ x y)) t_0) (+ x y)))
(* (/ (/ y t_0) (+ x y)) (/ x y))))))
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (y <= -1.8e-48) {
tmp = y / ((x + y) * t_0);
} else if (y <= 5.4e+133) {
tmp = x * (((y / (x + y)) / t_0) / (x + y));
} else {
tmp = ((y / 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 + 1.0d0)
if (y <= (-1.8d-48)) then
tmp = y / ((x + y) * t_0)
else if (y <= 5.4d+133) then
tmp = x * (((y / (x + y)) / t_0) / (x + y))
else
tmp = ((y / 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 + 1.0);
double tmp;
if (y <= -1.8e-48) {
tmp = y / ((x + y) * t_0);
} else if (y <= 5.4e+133) {
tmp = x * (((y / (x + y)) / t_0) / (x + y));
} else {
tmp = ((y / t_0) / (x + y)) * (x / y);
}
return tmp;
}
def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if y <= -1.8e-48: tmp = y / ((x + y) * t_0) elif y <= 5.4e+133: tmp = x * (((y / (x + y)) / t_0) / (x + y)) else: tmp = ((y / t_0) / (x + y)) * (x / y) return tmp
function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (y <= -1.8e-48) tmp = Float64(y / Float64(Float64(x + y) * t_0)); elseif (y <= 5.4e+133) tmp = Float64(x * Float64(Float64(Float64(y / Float64(x + y)) / t_0) / Float64(x + y))); else tmp = Float64(Float64(Float64(y / t_0) / Float64(x + y)) * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) t_0 = y + (x + 1.0); tmp = 0.0; if (y <= -1.8e-48) tmp = y / ((x + y) * t_0); elseif (y <= 5.4e+133) tmp = x * (((y / (x + y)) / t_0) / (x + y)); else tmp = ((y / t_0) / (x + y)) * (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, -1.8e-48], N[(y / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.4e+133], N[(x * N[(N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / t$95$0), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;y \leq -1.8 \cdot 10^{-48}:\\
\;\;\;\;\frac{y}{\left(x + y\right) \cdot t\_0}\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{+133}:\\
\;\;\;\;x \cdot \frac{\frac{\frac{y}{x + y}}{t\_0}}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{t\_0}}{x + y} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < -1.8000000000000001e-48Initial program 66.2%
associate-*l*66.2%
times-frac91.8%
+-commutative91.8%
+-commutative91.8%
associate-+r+91.8%
+-commutative91.8%
associate-+l+91.8%
Applied egg-rr91.8%
Taylor expanded in x around inf 54.4%
if -1.8000000000000001e-48 < y < 5.4000000000000004e133Initial program 67.7%
associate-/l*80.9%
associate-+l+80.9%
Simplified80.9%
*-un-lft-identity80.9%
associate-+r+80.9%
associate-*l*80.9%
times-frac96.6%
+-commutative96.6%
+-commutative96.6%
associate-+r+96.6%
+-commutative96.6%
associate-+l+96.6%
Applied egg-rr96.6%
associate-*l/96.7%
*-lft-identity96.7%
associate-/r*96.8%
+-commutative96.8%
Simplified96.8%
if 5.4000000000000004e133 < y Initial program 63.5%
associate-*l*63.5%
times-frac87.0%
+-commutative87.0%
+-commutative87.0%
associate-+r+87.0%
+-commutative87.0%
associate-+l+87.0%
Applied egg-rr87.0%
*-un-lft-identity87.0%
times-frac99.9%
+-commutative99.9%
Applied egg-rr99.9%
associate-*l/100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 92.7%
Final simplification86.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (+ x 1.0))))
(if (<= y 6.5e+128)
(* (/ x (+ x y)) (/ y (* (+ x y) t_0)))
(* (/ (/ y t_0) (+ x y)) (/ x y)))))
double code(double x, double y) {
double t_0 = y + (x + 1.0);
double tmp;
if (y <= 6.5e+128) {
tmp = (x / (x + y)) * (y / ((x + y) * t_0));
} else {
tmp = ((y / 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 + 1.0d0)
if (y <= 6.5d+128) then
tmp = (x / (x + y)) * (y / ((x + y) * t_0))
else
tmp = ((y / 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 + 1.0);
double tmp;
if (y <= 6.5e+128) {
tmp = (x / (x + y)) * (y / ((x + y) * t_0));
} else {
tmp = ((y / t_0) / (x + y)) * (x / y);
}
return tmp;
}
def code(x, y): t_0 = y + (x + 1.0) tmp = 0 if y <= 6.5e+128: tmp = (x / (x + y)) * (y / ((x + y) * t_0)) else: tmp = ((y / t_0) / (x + y)) * (x / y) return tmp
function code(x, y) t_0 = Float64(y + Float64(x + 1.0)) tmp = 0.0 if (y <= 6.5e+128) tmp = Float64(Float64(x / Float64(x + y)) * Float64(y / Float64(Float64(x + y) * t_0))); else tmp = Float64(Float64(Float64(y / t_0) / Float64(x + y)) * Float64(x / y)); end return tmp end
function tmp_2 = code(x, y) t_0 = y + (x + 1.0); tmp = 0.0; if (y <= 6.5e+128) tmp = (x / (x + y)) * (y / ((x + y) * t_0)); else tmp = ((y / t_0) / (x + y)) * (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, 6.5e+128], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(y / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / t$95$0), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;y \leq 6.5 \cdot 10^{+128}:\\
\;\;\;\;\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{t\_0}}{x + y} \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < 6.5000000000000003e128Initial program 67.6%
associate-*l*67.6%
times-frac97.3%
+-commutative97.3%
+-commutative97.3%
associate-+r+97.3%
+-commutative97.3%
associate-+l+97.3%
Applied egg-rr97.3%
if 6.5000000000000003e128 < y Initial program 62.2%
associate-*l*62.2%
times-frac87.3%
+-commutative87.3%
+-commutative87.3%
associate-+r+87.3%
+-commutative87.3%
associate-+l+87.3%
Applied egg-rr87.3%
*-un-lft-identity87.3%
times-frac99.9%
+-commutative99.9%
Applied egg-rr99.9%
associate-*l/99.9%
*-lft-identity99.9%
Simplified99.9%
Taylor expanded in x around 0 92.8%
Final simplification96.6%
(FPCore (x y) :precision binary64 (if (<= x -2.5e-9) (/ y (* (+ x y) (+ y (+ x 1.0)))) (* (/ x (+ x y)) (/ (/ y (+ y 1.0)) (+ x y)))))
double code(double x, double y) {
double tmp;
if (x <= -2.5e-9) {
tmp = y / ((x + y) * (y + (x + 1.0)));
} else {
tmp = (x / (x + y)) * ((y / (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 (x <= (-2.5d-9)) then
tmp = y / ((x + y) * (y + (x + 1.0d0)))
else
tmp = (x / (x + y)) * ((y / (y + 1.0d0)) / (x + y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -2.5e-9) {
tmp = y / ((x + y) * (y + (x + 1.0)));
} else {
tmp = (x / (x + y)) * ((y / (y + 1.0)) / (x + y));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -2.5e-9: tmp = y / ((x + y) * (y + (x + 1.0))) else: tmp = (x / (x + y)) * ((y / (y + 1.0)) / (x + y)) return tmp
function code(x, y) tmp = 0.0 if (x <= -2.5e-9) tmp = Float64(y / Float64(Float64(x + y) * Float64(y + Float64(x + 1.0)))); else tmp = Float64(Float64(x / Float64(x + y)) * Float64(Float64(y / Float64(y + 1.0)) / Float64(x + y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -2.5e-9) tmp = y / ((x + y) * (y + (x + 1.0))); else tmp = (x / (x + y)) * ((y / (y + 1.0)) / (x + y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -2.5e-9], N[(y / N[(N[(x + y), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{-9}:\\
\;\;\;\;\frac{y}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + y} \cdot \frac{\frac{y}{y + 1}}{x + y}\\
\end{array}
\end{array}
if x < -2.5000000000000001e-9Initial program 70.3%
associate-*l*70.3%
times-frac94.1%
+-commutative94.1%
+-commutative94.1%
associate-+r+94.1%
+-commutative94.1%
associate-+l+94.1%
Applied egg-rr94.1%
Taylor expanded in x around inf 83.4%
if -2.5000000000000001e-9 < x Initial program 65.7%
associate-*l*65.7%
times-frac96.2%
+-commutative96.2%
+-commutative96.2%
associate-+r+96.2%
+-commutative96.2%
associate-+l+96.2%
Applied egg-rr96.2%
*-un-lft-identity96.2%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.9%
*-lft-identity99.9%
Simplified99.9%
Taylor expanded in x around 0 85.7%
+-commutative85.7%
Simplified85.7%
Final simplification85.2%
(FPCore (x y) :precision binary64 (if (<= x -1.25e-191) (/ y (* (+ x y) (+ y (+ x 1.0)))) (/ (/ x y) (+ y 1.0))))
double code(double x, double y) {
double tmp;
if (x <= -1.25e-191) {
tmp = y / ((x + y) * (y + (x + 1.0)));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.25d-191)) then
tmp = y / ((x + y) * (y + (x + 1.0d0)))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.25e-191) {
tmp = y / ((x + y) * (y + (x + 1.0)));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.25e-191: tmp = y / ((x + y) * (y + (x + 1.0))) else: tmp = (x / y) / (y + 1.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -1.25e-191) tmp = Float64(y / Float64(Float64(x + y) * Float64(y + Float64(x + 1.0)))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.25e-191) tmp = y / ((x + y) * (y + (x + 1.0))); else tmp = (x / y) / (y + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.25e-191], N[(y / N[(N[(x + y), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{-191}:\\
\;\;\;\;\frac{y}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -1.25e-191Initial program 73.9%
associate-*l*73.9%
times-frac96.6%
+-commutative96.6%
+-commutative96.6%
associate-+r+96.6%
+-commutative96.6%
associate-+l+96.6%
Applied egg-rr96.6%
Taylor expanded in x around inf 79.0%
if -1.25e-191 < x Initial program 61.9%
associate-*l*61.9%
times-frac95.1%
+-commutative95.1%
+-commutative95.1%
associate-+r+95.1%
+-commutative95.1%
associate-+l+95.1%
Applied egg-rr95.1%
Taylor expanded in x around 0 58.4%
associate-/r*58.1%
+-commutative58.1%
Simplified58.1%
Final simplification66.5%
(FPCore (x y) :precision binary64 (if (<= x -4.1e-97) (/ (/ y (+ x y)) (+ x 1.0)) (/ (/ x y) (+ y 1.0))))
double code(double x, double y) {
double tmp;
if (x <= -4.1e-97) {
tmp = (y / (x + y)) / (x + 1.0);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-4.1d-97)) then
tmp = (y / (x + y)) / (x + 1.0d0)
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -4.1e-97) {
tmp = (y / (x + y)) / (x + 1.0);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -4.1e-97: tmp = (y / (x + y)) / (x + 1.0) else: tmp = (x / y) / (y + 1.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -4.1e-97) tmp = Float64(Float64(y / Float64(x + y)) / Float64(x + 1.0)); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -4.1e-97) tmp = (y / (x + y)) / (x + 1.0); else tmp = (x / y) / (y + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -4.1e-97], N[(N[(y / N[(x + y), $MachinePrecision]), $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}\;x \leq -4.1 \cdot 10^{-97}:\\
\;\;\;\;\frac{\frac{y}{x + y}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -4.09999999999999993e-97Initial program 73.5%
associate-*l*73.5%
times-frac95.7%
+-commutative95.7%
+-commutative95.7%
associate-+r+95.7%
+-commutative95.7%
associate-+l+95.7%
Applied egg-rr95.7%
clear-num95.7%
associate-/r*99.8%
frac-times99.0%
*-un-lft-identity99.0%
+-commutative99.0%
Applied egg-rr99.0%
Taylor expanded in y around 0 68.9%
+-commutative68.9%
Simplified68.9%
if -4.09999999999999993e-97 < x Initial program 63.5%
associate-*l*63.5%
times-frac95.7%
+-commutative95.7%
+-commutative95.7%
associate-+r+95.7%
+-commutative95.7%
associate-+l+95.7%
Applied egg-rr95.7%
Taylor expanded in x around 0 59.3%
associate-/r*59.1%
+-commutative59.1%
Simplified59.1%
Final simplification62.3%
(FPCore (x y) :precision binary64 (if (<= y 4.8e-230) (/ y x) (/ x (* y (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if (y <= 4.8e-230) {
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 <= 4.8d-230) 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 <= 4.8e-230) {
tmp = y / x;
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 4.8e-230: tmp = y / x else: tmp = x / (y * (y + 1.0)) return tmp
function code(x, y) tmp = 0.0 if (y <= 4.8e-230) 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 <= 4.8e-230) tmp = y / x; else tmp = x / (y * (y + 1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 4.8e-230], 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 4.8 \cdot 10^{-230}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if y < 4.8000000000000004e-230Initial program 67.8%
associate-/l*78.9%
associate-+l+78.9%
Simplified78.9%
Taylor expanded in y around 0 59.0%
associate-/r*59.5%
+-commutative59.5%
Simplified59.5%
Taylor expanded in x around 0 42.7%
if 4.8000000000000004e-230 < y Initial program 65.5%
associate-/l*83.9%
associate-+l+83.9%
Simplified83.9%
Taylor expanded in x around 0 60.2%
+-commutative60.2%
Simplified60.2%
Final simplification51.2%
(FPCore (x y) :precision binary64 (if (<= x -5.5e-97) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
double code(double x, double y) {
double tmp;
if (x <= -5.5e-97) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-5.5d-97)) then
tmp = y / (x * (x + 1.0d0))
else
tmp = x / (y * (y + 1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -5.5e-97) {
tmp = y / (x * (x + 1.0));
} else {
tmp = x / (y * (y + 1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -5.5e-97: tmp = y / (x * (x + 1.0)) else: tmp = x / (y * (y + 1.0)) return tmp
function code(x, y) tmp = 0.0 if (x <= -5.5e-97) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(x / Float64(y * Float64(y + 1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -5.5e-97) tmp = y / (x * (x + 1.0)); else tmp = x / (y * (y + 1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -5.5e-97], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{-97}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\
\end{array}
\end{array}
if x < -5.49999999999999948e-97Initial program 73.5%
associate-/l*83.1%
associate-+l+83.1%
Simplified83.1%
Taylor expanded in y around 0 68.4%
if -5.49999999999999948e-97 < x Initial program 63.5%
associate-/l*80.6%
associate-+l+80.6%
Simplified80.6%
Taylor expanded in x around 0 59.3%
+-commutative59.3%
Simplified59.3%
Final simplification62.2%
(FPCore (x y) :precision binary64 (if (<= x -5.8e-97) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
double code(double x, double y) {
double tmp;
if (x <= -5.8e-97) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-5.8d-97)) then
tmp = y / (x * (x + 1.0d0))
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -5.8e-97) {
tmp = y / (x * (x + 1.0));
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -5.8e-97: tmp = y / (x * (x + 1.0)) else: tmp = (x / y) / (y + 1.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -5.8e-97) tmp = Float64(y / Float64(x * Float64(x + 1.0))); else tmp = Float64(Float64(x / y) / Float64(y + 1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -5.8e-97) tmp = y / (x * (x + 1.0)); else tmp = (x / y) / (y + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -5.8e-97], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{-97}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -5.7999999999999999e-97Initial program 73.5%
associate-/l*83.1%
associate-+l+83.1%
Simplified83.1%
Taylor expanded in y around 0 68.4%
if -5.7999999999999999e-97 < x Initial program 63.5%
associate-*l*63.5%
times-frac95.7%
+-commutative95.7%
+-commutative95.7%
associate-+r+95.7%
+-commutative95.7%
associate-+l+95.7%
Applied egg-rr95.7%
Taylor expanded in x around 0 59.3%
associate-/r*59.1%
+-commutative59.1%
Simplified59.1%
Final simplification62.1%
(FPCore (x y) :precision binary64 (if (<= x -4.8e-97) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (+ y 1.0))))
double code(double x, double y) {
double tmp;
if (x <= -4.8e-97) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-4.8d-97)) then
tmp = (y / x) / (x + 1.0d0)
else
tmp = (x / y) / (y + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -4.8e-97) {
tmp = (y / x) / (x + 1.0);
} else {
tmp = (x / y) / (y + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -4.8e-97: tmp = (y / x) / (x + 1.0) else: tmp = (x / y) / (y + 1.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -4.8e-97) 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 (x <= -4.8e-97) tmp = (y / x) / (x + 1.0); else tmp = (x / y) / (y + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -4.8e-97], 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}\;x \leq -4.8 \cdot 10^{-97}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\
\end{array}
\end{array}
if x < -4.8e-97Initial program 73.5%
associate-/l*83.1%
associate-+l+83.1%
Simplified83.1%
Taylor expanded in y around 0 68.4%
associate-/r*68.5%
+-commutative68.5%
Simplified68.5%
if -4.8e-97 < x Initial program 63.5%
associate-*l*63.5%
times-frac95.7%
+-commutative95.7%
+-commutative95.7%
associate-+r+95.7%
+-commutative95.7%
associate-+l+95.7%
Applied egg-rr95.7%
Taylor expanded in x around 0 59.3%
associate-/r*59.1%
+-commutative59.1%
Simplified59.1%
Final simplification62.1%
(FPCore (x y) :precision binary64 (if (<= x -5e-97) (/ y x) (/ x y)))
double code(double x, double y) {
double tmp;
if (x <= -5e-97) {
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 <= (-5d-97)) 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 <= -5e-97) {
tmp = y / x;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -5e-97: tmp = y / x else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if (x <= -5e-97) tmp = Float64(y / x); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -5e-97) tmp = y / x; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -5e-97], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-97}:\\
\;\;\;\;\frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -4.9999999999999995e-97Initial program 73.5%
associate-/l*83.1%
associate-+l+83.1%
Simplified83.1%
Taylor expanded in y around 0 68.4%
associate-/r*68.5%
+-commutative68.5%
Simplified68.5%
Taylor expanded in x around 0 38.3%
if -4.9999999999999995e-97 < x Initial program 63.5%
associate-/l*80.6%
associate-+l+80.6%
Simplified80.6%
Taylor expanded in x around 0 59.3%
+-commutative59.3%
Simplified59.3%
Taylor expanded in y around 0 39.4%
Final simplification39.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 66.7%
associate-*l*66.7%
times-frac95.7%
+-commutative95.7%
+-commutative95.7%
associate-+r+95.7%
+-commutative95.7%
associate-+l+95.7%
Applied egg-rr95.7%
*-un-lft-identity95.7%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.9%
*-lft-identity99.9%
Simplified99.9%
Taylor expanded in y around inf 37.1%
Taylor expanded in x around inf 4.0%
Final simplification4.0%
(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 66.7%
associate-/l*81.4%
associate-+l+81.4%
Simplified81.4%
Taylor expanded in x around 0 49.8%
+-commutative49.8%
Simplified49.8%
Taylor expanded in y around 0 28.1%
Final simplification28.1%
(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 2024074
(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))))