
(FPCore (x y) :precision binary64 -0.8273960599468214)
double code(double x, double y) {
return -0.8273960599468214;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = -0.8273960599468214d0
end function
public static double code(double x, double y) {
return -0.8273960599468214;
}
def code(x, y): return -0.8273960599468214
function code(x, y) return -0.8273960599468214 end
function tmp = code(x, y) tmp = -0.8273960599468214; end
code[x_, y_] := -0.8273960599468214
\begin{array}{l}
\\
-0.8273960599468214
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 6 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y)
:precision binary64
(+
(+
(+
(* 333.75 (pow y 6.0))
(*
(* x x)
(-
(- (- (* (* (* (* 11.0 x) x) y) y) (pow y 6.0)) (* 121.0 (pow y 4.0)))
2.0)))
(* 5.5 (pow y 8.0)))
(/ x (* 2.0 y))))
double code(double x, double y) {
return (((333.75 * pow(y, 6.0)) + ((x * x) * (((((((11.0 * x) * x) * y) * y) - pow(y, 6.0)) - (121.0 * pow(y, 4.0))) - 2.0))) + (5.5 * pow(y, 8.0))) + (x / (2.0 * y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (((333.75d0 * (y ** 6.0d0)) + ((x * x) * (((((((11.0d0 * x) * x) * y) * y) - (y ** 6.0d0)) - (121.0d0 * (y ** 4.0d0))) - 2.0d0))) + (5.5d0 * (y ** 8.0d0))) + (x / (2.0d0 * y))
end function
public static double code(double x, double y) {
return (((333.75 * Math.pow(y, 6.0)) + ((x * x) * (((((((11.0 * x) * x) * y) * y) - Math.pow(y, 6.0)) - (121.0 * Math.pow(y, 4.0))) - 2.0))) + (5.5 * Math.pow(y, 8.0))) + (x / (2.0 * y));
}
def code(x, y): return (((333.75 * math.pow(y, 6.0)) + ((x * x) * (((((((11.0 * x) * x) * y) * y) - math.pow(y, 6.0)) - (121.0 * math.pow(y, 4.0))) - 2.0))) + (5.5 * math.pow(y, 8.0))) + (x / (2.0 * y))
function code(x, y) return Float64(Float64(Float64(Float64(333.75 * (y ^ 6.0)) + Float64(Float64(x * x) * Float64(Float64(Float64(Float64(Float64(Float64(Float64(11.0 * x) * x) * y) * y) - (y ^ 6.0)) - Float64(121.0 * (y ^ 4.0))) - 2.0))) + Float64(5.5 * (y ^ 8.0))) + Float64(x / Float64(2.0 * y))) end
function tmp = code(x, y) tmp = (((333.75 * (y ^ 6.0)) + ((x * x) * (((((((11.0 * x) * x) * y) * y) - (y ^ 6.0)) - (121.0 * (y ^ 4.0))) - 2.0))) + (5.5 * (y ^ 8.0))) + (x / (2.0 * y)); end
code[x_, y_] := N[(N[(N[(N[(333.75 * N[Power[y, 6.0], $MachinePrecision]), $MachinePrecision] + N[(N[(x * x), $MachinePrecision] * N[(N[(N[(N[(N[(N[(N[(11.0 * x), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision] - N[Power[y, 6.0], $MachinePrecision]), $MachinePrecision] - N[(121.0 * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(5.5 * N[Power[y, 8.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x / N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(333.75 \cdot {y}^{6} + \left(x \cdot x\right) \cdot \left(\left(\left(\left(\left(\left(11 \cdot x\right) \cdot x\right) \cdot y\right) \cdot y - {y}^{6}\right) - 121 \cdot {y}^{4}\right) - 2\right)\right) + 5.5 \cdot {y}^{8}\right) + \frac{x}{2 \cdot y}
\end{array}
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(+
(+
(+
(* 333.75 (pow y 6.0))
(*
(* x x)
(-
(- (- (* (* (* (* 11.0 x) x) y) y) (pow y 6.0)) (* 121.0 (pow y 4.0)))
2.0)))
(* 5.5 (pow y 8.0)))
(/ x (* 2.0 y))))x = abs(x);
y = abs(y);
assert(x < y);
double code(double x, double y) {
return (((333.75 * pow(y, 6.0)) + ((x * x) * (((((((11.0 * x) * x) * y) * y) - pow(y, 6.0)) - (121.0 * pow(y, 4.0))) - 2.0))) + (5.5 * pow(y, 8.0))) + (x / (2.0 * y));
}
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (((333.75d0 * (y ** 6.0d0)) + ((x * x) * (((((((11.0d0 * x) * x) * y) * y) - (y ** 6.0d0)) - (121.0d0 * (y ** 4.0d0))) - 2.0d0))) + (5.5d0 * (y ** 8.0d0))) + (x / (2.0d0 * y))
end function
x = Math.abs(x);
y = Math.abs(y);
assert x < y;
public static double code(double x, double y) {
return (((333.75 * Math.pow(y, 6.0)) + ((x * x) * (((((((11.0 * x) * x) * y) * y) - Math.pow(y, 6.0)) - (121.0 * Math.pow(y, 4.0))) - 2.0))) + (5.5 * Math.pow(y, 8.0))) + (x / (2.0 * y));
}
x = abs(x) y = abs(y) [x, y] = sort([x, y]) def code(x, y): return (((333.75 * math.pow(y, 6.0)) + ((x * x) * (((((((11.0 * x) * x) * y) * y) - math.pow(y, 6.0)) - (121.0 * math.pow(y, 4.0))) - 2.0))) + (5.5 * math.pow(y, 8.0))) + (x / (2.0 * y))
x = abs(x) y = abs(y) x, y = sort([x, y]) function code(x, y) return Float64(Float64(Float64(Float64(333.75 * (y ^ 6.0)) + Float64(Float64(x * x) * Float64(Float64(Float64(Float64(Float64(Float64(Float64(11.0 * x) * x) * y) * y) - (y ^ 6.0)) - Float64(121.0 * (y ^ 4.0))) - 2.0))) + Float64(5.5 * (y ^ 8.0))) + Float64(x / Float64(2.0 * y))) end
x = abs(x)
y = abs(y)
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
tmp = (((333.75 * (y ^ 6.0)) + ((x * x) * (((((((11.0 * x) * x) * y) * y) - (y ^ 6.0)) - (121.0 * (y ^ 4.0))) - 2.0))) + (5.5 * (y ^ 8.0))) + (x / (2.0 * y));
end
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(N[(N[(333.75 * N[Power[y, 6.0], $MachinePrecision]), $MachinePrecision] + N[(N[(x * x), $MachinePrecision] * N[(N[(N[(N[(N[(N[(N[(11.0 * x), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision] - N[Power[y, 6.0], $MachinePrecision]), $MachinePrecision] - N[(121.0 * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(5.5 * N[Power[y, 8.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x / N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
y = |y|\\
[x, y] = \mathsf{sort}([x, y])\\
\\
\left(\left(333.75 \cdot {y}^{6} + \left(x \cdot x\right) \cdot \left(\left(\left(\left(\left(\left(11 \cdot x\right) \cdot x\right) \cdot y\right) \cdot y - {y}^{6}\right) - 121 \cdot {y}^{4}\right) - 2\right)\right) + 5.5 \cdot {y}^{8}\right) + \frac{x}{2 \cdot y}
\end{array}
Initial program 9.2%
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(+
(fma
333.75
(pow y 6.0)
(*
(* x x)
(-
(- (* y (* y (* x (* x 11.0)))) (pow y 6.0))
(+ (* 121.0 (pow y 4.0)) 2.0))))
(+ (* 5.5 (pow y 8.0)) (/ x (* y 2.0)))))x = abs(x);
y = abs(y);
assert(x < y);
double code(double x, double y) {
return fma(333.75, pow(y, 6.0), ((x * x) * (((y * (y * (x * (x * 11.0)))) - pow(y, 6.0)) - ((121.0 * pow(y, 4.0)) + 2.0)))) + ((5.5 * pow(y, 8.0)) + (x / (y * 2.0)));
}
x = abs(x) y = abs(y) x, y = sort([x, y]) function code(x, y) return Float64(fma(333.75, (y ^ 6.0), Float64(Float64(x * x) * Float64(Float64(Float64(y * Float64(y * Float64(x * Float64(x * 11.0)))) - (y ^ 6.0)) - Float64(Float64(121.0 * (y ^ 4.0)) + 2.0)))) + Float64(Float64(5.5 * (y ^ 8.0)) + Float64(x / Float64(y * 2.0)))) end
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(333.75 * N[Power[y, 6.0], $MachinePrecision] + N[(N[(x * x), $MachinePrecision] * N[(N[(N[(y * N[(y * N[(x * N[(x * 11.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[y, 6.0], $MachinePrecision]), $MachinePrecision] - N[(N[(121.0 * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(5.5 * N[Power[y, 8.0], $MachinePrecision]), $MachinePrecision] + N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
y = |y|\\
[x, y] = \mathsf{sort}([x, y])\\
\\
\mathsf{fma}\left(333.75, {y}^{6}, \left(x \cdot x\right) \cdot \left(\left(y \cdot \left(y \cdot \left(x \cdot \left(x \cdot 11\right)\right)\right) - {y}^{6}\right) - \left(121 \cdot {y}^{4} + 2\right)\right)\right) + \left(5.5 \cdot {y}^{8} + \frac{x}{y \cdot 2}\right)
\end{array}
Initial program 9.2%
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(+
(fma
333.75
(pow y 6.0)
(*
x
(*
x
(-
(fma y (* (* y 11.0) (* x x)) (- (pow y 6.0)))
(fma 121.0 (pow y 4.0) 2.0)))))
(fma 5.5 (pow y 8.0) (/ x (* y 2.0)))))x = abs(x);
y = abs(y);
assert(x < y);
double code(double x, double y) {
return fma(333.75, pow(y, 6.0), (x * (x * (fma(y, ((y * 11.0) * (x * x)), -pow(y, 6.0)) - fma(121.0, pow(y, 4.0), 2.0))))) + fma(5.5, pow(y, 8.0), (x / (y * 2.0)));
}
x = abs(x) y = abs(y) x, y = sort([x, y]) function code(x, y) return Float64(fma(333.75, (y ^ 6.0), Float64(x * Float64(x * Float64(fma(y, Float64(Float64(y * 11.0) * Float64(x * x)), Float64(-(y ^ 6.0))) - fma(121.0, (y ^ 4.0), 2.0))))) + fma(5.5, (y ^ 8.0), Float64(x / Float64(y * 2.0)))) end
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(N[(333.75 * N[Power[y, 6.0], $MachinePrecision] + N[(x * N[(x * N[(N[(y * N[(N[(y * 11.0), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] + (-N[Power[y, 6.0], $MachinePrecision])), $MachinePrecision] - N[(121.0 * N[Power[y, 4.0], $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(5.5 * N[Power[y, 8.0], $MachinePrecision] + N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
y = |y|\\
[x, y] = \mathsf{sort}([x, y])\\
\\
\mathsf{fma}\left(333.75, {y}^{6}, x \cdot \left(x \cdot \left(\mathsf{fma}\left(y, \left(y \cdot 11\right) \cdot \left(x \cdot x\right), -{y}^{6}\right) - \mathsf{fma}\left(121, {y}^{4}, 2\right)\right)\right)\right) + \mathsf{fma}\left(5.5, {y}^{8}, \frac{x}{y \cdot 2}\right)
\end{array}
Initial program 3.1%
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
:precision binary64
(fma
333.75
(pow y 6.0)
(fma
(* x x)
(fma
y
(* y (* x (* x 11.0)))
(fma -1.0 (pow y 6.0) (fma (pow y 4.0) -121.0 -2.0)))
(fma 5.5 (pow y 8.0) (/ x (* y 2.0))))))x = abs(x);
y = abs(y);
assert(x < y);
double code(double x, double y) {
return fma(333.75, pow(y, 6.0), fma((x * x), fma(y, (y * (x * (x * 11.0))), fma(-1.0, pow(y, 6.0), fma(pow(y, 4.0), -121.0, -2.0))), fma(5.5, pow(y, 8.0), (x / (y * 2.0)))));
}
x = abs(x) y = abs(y) x, y = sort([x, y]) function code(x, y) return fma(333.75, (y ^ 6.0), fma(Float64(x * x), fma(y, Float64(y * Float64(x * Float64(x * 11.0))), fma(-1.0, (y ^ 6.0), fma((y ^ 4.0), -121.0, -2.0))), fma(5.5, (y ^ 8.0), Float64(x / Float64(y * 2.0))))) end
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(333.75 * N[Power[y, 6.0], $MachinePrecision] + N[(N[(x * x), $MachinePrecision] * N[(y * N[(y * N[(x * N[(x * 11.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 * N[Power[y, 6.0], $MachinePrecision] + N[(N[Power[y, 4.0], $MachinePrecision] * -121.0 + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(5.5 * N[Power[y, 8.0], $MachinePrecision] + N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
y = |y|\\
[x, y] = \mathsf{sort}([x, y])\\
\\
\mathsf{fma}\left(333.75, {y}^{6}, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(y, y \cdot \left(x \cdot \left(x \cdot 11\right)\right), \mathsf{fma}\left(-1, {y}^{6}, \mathsf{fma}\left({y}^{4}, -121, -2\right)\right)\right), \mathsf{fma}\left(5.5, {y}^{8}, \frac{x}{y \cdot 2}\right)\right)\right)
\end{array}
Initial program 9.2%
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (fma 333.75 (pow y 6.0) (fma (* x x) (- (fma (* y 11.0) (* y (* x x)) (fma (pow y 4.0) -121.0 -2.0)) (pow y 6.0)) (fma 5.5 (pow y 8.0) (/ (/ x 2.0) y)))))
x = abs(x);
y = abs(y);
assert(x < y);
double code(double x, double y) {
return fma(333.75, pow(y, 6.0), fma((x * x), (fma((y * 11.0), (y * (x * x)), fma(pow(y, 4.0), -121.0, -2.0)) - pow(y, 6.0)), fma(5.5, pow(y, 8.0), ((x / 2.0) / y))));
}
x = abs(x) y = abs(y) x, y = sort([x, y]) function code(x, y) return fma(333.75, (y ^ 6.0), fma(Float64(x * x), Float64(fma(Float64(y * 11.0), Float64(y * Float64(x * x)), fma((y ^ 4.0), -121.0, -2.0)) - (y ^ 6.0)), fma(5.5, (y ^ 8.0), Float64(Float64(x / 2.0) / y)))) end
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(333.75 * N[Power[y, 6.0], $MachinePrecision] + N[(N[(x * x), $MachinePrecision] * N[(N[(N[(y * 11.0), $MachinePrecision] * N[(y * N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(N[Power[y, 4.0], $MachinePrecision] * -121.0 + -2.0), $MachinePrecision]), $MachinePrecision] - N[Power[y, 6.0], $MachinePrecision]), $MachinePrecision] + N[(5.5 * N[Power[y, 8.0], $MachinePrecision] + N[(N[(x / 2.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
y = |y|\\
[x, y] = \mathsf{sort}([x, y])\\
\\
\mathsf{fma}\left(333.75, {y}^{6}, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(y \cdot 11, y \cdot \left(x \cdot x\right), \mathsf{fma}\left({y}^{4}, -121, -2\right)\right) - {y}^{6}, \mathsf{fma}\left(5.5, {y}^{8}, \frac{\frac{x}{2}}{y}\right)\right)\right)
\end{array}
Initial program 1.5%
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y) :precision binary64 (fma 333.75 (pow y 6.0) (fma (* x x) (- (* y (* y (* x (* x 11.0)))) (fma (pow y 4.0) (fma y y 121.0) 2.0)) (fma 5.5 (pow y 8.0) (/ x (* y 2.0))))))
x = abs(x);
y = abs(y);
assert(x < y);
double code(double x, double y) {
return fma(333.75, pow(y, 6.0), fma((x * x), ((y * (y * (x * (x * 11.0)))) - fma(pow(y, 4.0), fma(y, y, 121.0), 2.0)), fma(5.5, pow(y, 8.0), (x / (y * 2.0)))));
}
x = abs(x) y = abs(y) x, y = sort([x, y]) function code(x, y) return fma(333.75, (y ^ 6.0), fma(Float64(x * x), Float64(Float64(y * Float64(y * Float64(x * Float64(x * 11.0)))) - fma((y ^ 4.0), fma(y, y, 121.0), 2.0)), fma(5.5, (y ^ 8.0), Float64(x / Float64(y * 2.0))))) end
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_] := N[(333.75 * N[Power[y, 6.0], $MachinePrecision] + N[(N[(x * x), $MachinePrecision] * N[(N[(y * N[(y * N[(x * N[(x * 11.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Power[y, 4.0], $MachinePrecision] * N[(y * y + 121.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + N[(5.5 * N[Power[y, 8.0], $MachinePrecision] + N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x = |x|\\
y = |y|\\
[x, y] = \mathsf{sort}([x, y])\\
\\
\mathsf{fma}\left(333.75, {y}^{6}, \mathsf{fma}\left(x \cdot x, y \cdot \left(y \cdot \left(x \cdot \left(x \cdot 11\right)\right)\right) - \mathsf{fma}\left({y}^{4}, \mathsf{fma}\left(y, y, 121\right), 2\right), \mathsf{fma}\left(5.5, {y}^{8}, \frac{x}{y \cdot 2}\right)\right)\right)
\end{array}
Initial program 1.5%
herbie shell --seed 2023275
(FPCore (x y)
:name "Rump's expression from Stadtherr's award speech"
:precision binary64
:pre (and (== x 77617.0) (== y 33096.0))
(+ (+ (+ (* 333.75 (pow y 6.0)) (* (* x x) (- (- (- (* (* (* (* 11.0 x) x) y) y) (pow y 6.0)) (* 121.0 (pow y 4.0))) 2.0))) (* 5.5 (pow y 8.0))) (/ x (* 2.0 y))))