
(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 3 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}
(FPCore (x y) :precision binary64 (/ (+ (* (pow y 7.0) (- 333.75 (pow x 2.0))) (* 0.5 x)) y))
double code(double x, double y) {
return ((pow(y, 7.0) * (333.75 - pow(x, 2.0))) + (0.5 * x)) / y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (((y ** 7.0d0) * (333.75d0 - (x ** 2.0d0))) + (0.5d0 * x)) / y
end function
public static double code(double x, double y) {
return ((Math.pow(y, 7.0) * (333.75 - Math.pow(x, 2.0))) + (0.5 * x)) / y;
}
def code(x, y): return ((math.pow(y, 7.0) * (333.75 - math.pow(x, 2.0))) + (0.5 * x)) / y
function code(x, y) return Float64(Float64(Float64((y ^ 7.0) * Float64(333.75 - (x ^ 2.0))) + Float64(0.5 * x)) / y) end
function tmp = code(x, y) tmp = (((y ^ 7.0) * (333.75 - (x ^ 2.0))) + (0.5 * x)) / y; end
code[x_, y_] := N[(N[(N[(N[Power[y, 7.0], $MachinePrecision] * N[(333.75 - N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{{y}^{7} \cdot \left(333.75 - {x}^{2}\right) + 0.5 \cdot x}{y}
\end{array}
Initial program 9.2%
log1p-expm1-u3.1%
Applied egg-rr3.1%
Taylor expanded in y around inf 1.5%
mul-1-neg1.5%
*-commutative1.5%
distribute-rgt-neg-in1.5%
Simplified1.5%
pow21.5%
distribute-rgt-neg-out1.5%
distribute-lft-neg-in1.5%
add-sqr-sqrt1.5%
sqrt-unprod1.5%
sqr-neg1.5%
sqrt-unprod0.0%
add-sqr-sqrt1.4%
cancel-sign-sub-inv1.4%
pow21.4%
log1p-expm1-u0.7%
*-commutative0.7%
pow20.7%
distribute-lft-out--0.7%
Applied egg-rr3.1%
Taylor expanded in y around 0 7.9%
Final simplification7.9%
(FPCore (x y) :precision binary64 (/ (- (* 0.5 x) (* (pow y 7.0) (pow x 2.0))) y))
double code(double x, double y) {
return ((0.5 * x) - (pow(y, 7.0) * pow(x, 2.0))) / y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((0.5d0 * x) - ((y ** 7.0d0) * (x ** 2.0d0))) / y
end function
public static double code(double x, double y) {
return ((0.5 * x) - (Math.pow(y, 7.0) * Math.pow(x, 2.0))) / y;
}
def code(x, y): return ((0.5 * x) - (math.pow(y, 7.0) * math.pow(x, 2.0))) / y
function code(x, y) return Float64(Float64(Float64(0.5 * x) - Float64((y ^ 7.0) * (x ^ 2.0))) / y) end
function tmp = code(x, y) tmp = ((0.5 * x) - ((y ^ 7.0) * (x ^ 2.0))) / y; end
code[x_, y_] := N[(N[(N[(0.5 * x), $MachinePrecision] - N[(N[Power[y, 7.0], $MachinePrecision] * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5 \cdot x - {y}^{7} \cdot {x}^{2}}{y}
\end{array}
Initial program 9.2%
log1p-expm1-u3.1%
Applied egg-rr3.1%
Taylor expanded in y around inf 1.5%
mul-1-neg1.5%
*-commutative1.5%
distribute-rgt-neg-in1.5%
Simplified1.5%
Taylor expanded in x around inf 8.6%
mul-1-neg8.6%
distribute-rgt-neg-in8.6%
Simplified8.6%
Taylor expanded in y around 0 7.9%
+-commutative7.9%
*-commutative7.9%
mul-1-neg7.9%
unsub-neg7.9%
Simplified7.9%
Final simplification7.9%
(FPCore (x y) :precision binary64 (/ (* 0.5 x) y))
double code(double x, double y) {
return (0.5 * x) / y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (0.5d0 * x) / y
end function
public static double code(double x, double y) {
return (0.5 * x) / y;
}
def code(x, y): return (0.5 * x) / y
function code(x, y) return Float64(Float64(0.5 * x) / y) end
function tmp = code(x, y) tmp = (0.5 * x) / y; end
code[x_, y_] := N[(N[(0.5 * x), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5 \cdot x}{y}
\end{array}
Initial program 9.2%
log1p-expm1-u3.1%
Applied egg-rr3.1%
Taylor expanded in y around inf 1.5%
mul-1-neg1.5%
*-commutative1.5%
distribute-rgt-neg-in1.5%
Simplified1.5%
pow21.5%
distribute-rgt-neg-out1.5%
distribute-lft-neg-in1.5%
add-sqr-sqrt1.5%
sqrt-unprod1.5%
sqr-neg1.5%
sqrt-unprod0.0%
add-sqr-sqrt1.4%
cancel-sign-sub-inv1.4%
pow21.4%
log1p-expm1-u0.7%
*-commutative0.7%
pow20.7%
distribute-lft-out--0.7%
Applied egg-rr3.1%
Taylor expanded in y around 0 1.6%
associate-*r/1.6%
*-commutative1.6%
Simplified1.6%
Final simplification1.6%
herbie shell --seed 2024111
(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))))