| Alternative 1 | |
|---|---|
| Error | 52.0 |
| Cost | 13632 |
\[\left(9 \cdot {x}^{4} - {y}^{4}\right) + 2 \cdot \left(y \cdot y\right)
\]
(FPCore (x y) :precision binary64 (+ (- (* 9.0 (pow x 4.0)) (pow y 4.0)) (* 2.0 (* y y))))
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (pow x 4.0) -9.0)) (t_1 (* 9.0 (pow x 4.0))))
(+
(if (!= t_0 0.0) (/ (* t_1 (+ (pow y 4.0) t_0)) t_0) (- t_1 (pow y 4.0)))
(* y (* y 2.0)))))double code(double x, double y) {
return ((9.0 * pow(x, 4.0)) - pow(y, 4.0)) + (2.0 * (y * y));
}
double code(double x, double y) {
double t_0 = pow(x, 4.0) * -9.0;
double t_1 = 9.0 * pow(x, 4.0);
double tmp;
if (t_0 != 0.0) {
tmp = (t_1 * (pow(y, 4.0) + t_0)) / t_0;
} else {
tmp = t_1 - pow(y, 4.0);
}
return tmp + (y * (y * 2.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((9.0d0 * (x ** 4.0d0)) - (y ** 4.0d0)) + (2.0d0 * (y * y))
end function
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 = (x ** 4.0d0) * (-9.0d0)
t_1 = 9.0d0 * (x ** 4.0d0)
if (t_0 /= 0.0d0) then
tmp = (t_1 * ((y ** 4.0d0) + t_0)) / t_0
else
tmp = t_1 - (y ** 4.0d0)
end if
code = tmp + (y * (y * 2.0d0))
end function
public static double code(double x, double y) {
return ((9.0 * Math.pow(x, 4.0)) - Math.pow(y, 4.0)) + (2.0 * (y * y));
}
public static double code(double x, double y) {
double t_0 = Math.pow(x, 4.0) * -9.0;
double t_1 = 9.0 * Math.pow(x, 4.0);
double tmp;
if (t_0 != 0.0) {
tmp = (t_1 * (Math.pow(y, 4.0) + t_0)) / t_0;
} else {
tmp = t_1 - Math.pow(y, 4.0);
}
return tmp + (y * (y * 2.0));
}
def code(x, y): return ((9.0 * math.pow(x, 4.0)) - math.pow(y, 4.0)) + (2.0 * (y * y))
def code(x, y): t_0 = math.pow(x, 4.0) * -9.0 t_1 = 9.0 * math.pow(x, 4.0) tmp = 0 if t_0 != 0.0: tmp = (t_1 * (math.pow(y, 4.0) + t_0)) / t_0 else: tmp = t_1 - math.pow(y, 4.0) return tmp + (y * (y * 2.0))
function code(x, y) return Float64(Float64(Float64(9.0 * (x ^ 4.0)) - (y ^ 4.0)) + Float64(2.0 * Float64(y * y))) end
function code(x, y) t_0 = Float64((x ^ 4.0) * -9.0) t_1 = Float64(9.0 * (x ^ 4.0)) tmp = 0.0 if (t_0 != 0.0) tmp = Float64(Float64(t_1 * Float64((y ^ 4.0) + t_0)) / t_0); else tmp = Float64(t_1 - (y ^ 4.0)); end return Float64(tmp + Float64(y * Float64(y * 2.0))) end
function tmp = code(x, y) tmp = ((9.0 * (x ^ 4.0)) - (y ^ 4.0)) + (2.0 * (y * y)); end
function tmp_2 = code(x, y) t_0 = (x ^ 4.0) * -9.0; t_1 = 9.0 * (x ^ 4.0); tmp = 0.0; if (t_0 ~= 0.0) tmp = (t_1 * ((y ^ 4.0) + t_0)) / t_0; else tmp = t_1 - (y ^ 4.0); end tmp_2 = tmp + (y * (y * 2.0)); end
code[x_, y_] := N[(N[(N[(9.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] - N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := Block[{t$95$0 = N[(N[Power[x, 4.0], $MachinePrecision] * -9.0), $MachinePrecision]}, Block[{t$95$1 = N[(9.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]}, N[(If[Unequal[t$95$0, 0.0], N[(N[(t$95$1 * N[(N[Power[y, 4.0], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], N[(t$95$1 - N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]] + N[(y * N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\left(9 \cdot {x}^{4} - {y}^{4}\right) + 2 \cdot \left(y \cdot y\right)
\begin{array}{l}
t_0 := {x}^{4} \cdot -9\\
t_1 := 9 \cdot {x}^{4}\\
\begin{array}{l}
\mathbf{if}\;t_0 \ne 0:\\
\;\;\;\;\frac{t_1 \cdot \left({y}^{4} + t_0\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;t_1 - {y}^{4}\\
\end{array} + y \cdot \left(y \cdot 2\right)
\end{array}
Initial program 52.0
Simplified52.0
[Start]52.0 | \[ \left(9 \cdot {x}^{4} - {y}^{4}\right) + 2 \cdot \left(y \cdot y\right)
\] |
|---|---|
rational_best-simplify-113 [=>]52.0 | \[ \left(9 \cdot {x}^{4} - {y}^{4}\right) + \color{blue}{y \cdot \left(2 \cdot y\right)}
\] |
rational_best-simplify-3 [=>]52.0 | \[ \left(9 \cdot {x}^{4} - {y}^{4}\right) + y \cdot \color{blue}{\left(y \cdot 2\right)}
\] |
Applied egg-rr52.0
Final simplification52.0
| Alternative 1 | |
|---|---|
| Error | 52.0 |
| Cost | 13632 |
| Alternative 2 | |
|---|---|
| Error | 57.8 |
| Cost | 7040 |
| Alternative 3 | |
|---|---|
| Error | 63.0 |
| Cost | 6976 |
herbie shell --seed 2023104
(FPCore (x y)
:name "From Rump in a 1983 paper"
:precision binary64
:pre (and (== x 10864.0) (== y 18817.0))
(+ (- (* 9.0 (pow x 4.0)) (pow y 4.0)) (* 2.0 (* y y))))