(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (+ y x) 1.0)))
(if (!= y 0.0)
(/ (/ (/ x (+ x y)) t_0) (/ (+ x y) y))
(/ (/ (/ (* x y) (+ x y)) t_0) (+ x y)))))double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
double code(double x, double y) {
double t_0 = (y + x) + 1.0;
double tmp;
if (y != 0.0) {
tmp = ((x / (x + y)) / t_0) / ((x + y) / y);
} 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
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
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.0d0) then
tmp = ((x / (x + y)) / t_0) / ((x + y) / y)
else
tmp = (((x * y) / (x + y)) / t_0) / (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
public static double code(double x, double y) {
double t_0 = (y + x) + 1.0;
double tmp;
if (y != 0.0) {
tmp = ((x / (x + y)) / t_0) / ((x + y) / y);
} else {
tmp = (((x * y) / (x + y)) / t_0) / (x + y);
}
return tmp;
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
def code(x, y): t_0 = (y + x) + 1.0 tmp = 0 if y != 0.0: tmp = ((x / (x + y)) / t_0) / ((x + y) / y) else: tmp = (((x * y) / (x + y)) / t_0) / (x + y) return tmp
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 code(x, y) t_0 = Float64(Float64(y + x) + 1.0) tmp = 0.0 if (y != 0.0) tmp = Float64(Float64(Float64(x / Float64(x + y)) / t_0) / Float64(Float64(x + y) / y)); else tmp = Float64(Float64(Float64(Float64(x * y) / Float64(x + y)) / t_0) / Float64(x + y)); end return tmp end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
function tmp_2 = code(x, y) t_0 = (y + x) + 1.0; tmp = 0.0; if (y ~= 0.0) tmp = ((x / (x + y)) / t_0) / ((x + y) / y); else tmp = (((x * y) / (x + y)) / t_0) / (x + y); end tmp_2 = tmp; 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]
code[x_, y_] := Block[{t$95$0 = N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]}, If[Unequal[y, 0.0], N[(N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x * y), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\begin{array}{l}
t_0 := \left(y + x\right) + 1\\
\mathbf{if}\;y \ne 0:\\
\;\;\;\;\frac{\frac{\frac{x}{x + y}}{t_0}}{\frac{x + y}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{x \cdot y}{x + y}}{t_0}}{x + y}\\
\end{array}
| Original | 31.07% |
|---|---|
| Target | 0.22% |
| Herbie | 0.22% |
Initial program 31.07
Applied egg-rr0.16
Simplified0.16
Applied egg-rr0.19
Applied egg-rr0.18
Applied egg-rr0.22
Simplified0.22
herbie shell --seed 2023136
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
:precision binary64
:herbie-target
(/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))