?

Average Error: 0.1 → 0.1
Time: 3.6s
Precision: binary64
Cost: 576

?

\[\left(\left(x \cdot y + z \cdot z\right) + z \cdot z\right) + z \cdot z \]
\[x \cdot y + z \cdot \left(3 \cdot z\right) \]
(FPCore (x y z)
 :precision binary64
 (+ (+ (+ (* x y) (* z z)) (* z z)) (* z z)))
(FPCore (x y z) :precision binary64 (+ (* x y) (* z (* 3.0 z))))
double code(double x, double y, double z) {
	return (((x * y) + (z * z)) + (z * z)) + (z * z);
}
double code(double x, double y, double z) {
	return (x * y) + (z * (3.0 * z));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (((x * y) + (z * z)) + (z * z)) + (z * z)
end function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x * y) + (z * (3.0d0 * z))
end function
public static double code(double x, double y, double z) {
	return (((x * y) + (z * z)) + (z * z)) + (z * z);
}
public static double code(double x, double y, double z) {
	return (x * y) + (z * (3.0 * z));
}
def code(x, y, z):
	return (((x * y) + (z * z)) + (z * z)) + (z * z)
def code(x, y, z):
	return (x * y) + (z * (3.0 * z))
function code(x, y, z)
	return Float64(Float64(Float64(Float64(x * y) + Float64(z * z)) + Float64(z * z)) + Float64(z * z))
end
function code(x, y, z)
	return Float64(Float64(x * y) + Float64(z * Float64(3.0 * z)))
end
function tmp = code(x, y, z)
	tmp = (((x * y) + (z * z)) + (z * z)) + (z * z);
end
function tmp = code(x, y, z)
	tmp = (x * y) + (z * (3.0 * z));
end
code[x_, y_, z_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] + N[(z * N[(3.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot y + z \cdot z\right) + z \cdot z\right) + z \cdot z
x \cdot y + z \cdot \left(3 \cdot z\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.1
Target0.1
Herbie0.1
\[\left(3 \cdot z\right) \cdot z + y \cdot x \]

Derivation?

  1. Initial program 0.1

    \[\left(\left(x \cdot y + z \cdot z\right) + z \cdot z\right) + z \cdot z \]
  2. Simplified0.1

    \[\leadsto \color{blue}{x \cdot y + z \cdot \left(z + \left(z + z\right)\right)} \]
    Proof

    [Start]0.1

    \[ \left(\left(x \cdot y + z \cdot z\right) + z \cdot z\right) + z \cdot z \]

    rational_best_oopsla_all_46_json_45_simplify-35 [=>]0.1

    \[ \color{blue}{z \cdot z + \left(\left(x \cdot y + z \cdot z\right) + z \cdot z\right)} \]

    rational_best_oopsla_all_46_json_45_simplify-35 [=>]0.1

    \[ z \cdot z + \color{blue}{\left(z \cdot z + \left(x \cdot y + z \cdot z\right)\right)} \]

    rational_best_oopsla_all_46_json_45_simplify-82 [=>]0.1

    \[ z \cdot z + \color{blue}{\left(x \cdot y + \left(z \cdot z + z \cdot z\right)\right)} \]

    rational_best_oopsla_all_46_json_45_simplify-82 [=>]0.1

    \[ \color{blue}{x \cdot y + \left(z \cdot z + \left(z \cdot z + z \cdot z\right)\right)} \]

    rational_best_oopsla_all_46_json_45_simplify-23 [=>]0.1

    \[ x \cdot y + \left(z \cdot z + \color{blue}{z \cdot \left(z + z\right)}\right) \]

    rational_best_oopsla_all_46_json_45_simplify-23 [=>]0.1

    \[ x \cdot y + \color{blue}{z \cdot \left(z + \left(z + z\right)\right)} \]
  3. Applied egg-rr0.1

    \[\leadsto x \cdot y + \color{blue}{\left(z \cdot \left(z \cdot 3\right) + 0\right)} \]
  4. Simplified0.1

    \[\leadsto x \cdot y + \color{blue}{z \cdot \left(3 \cdot z\right)} \]
    Proof

    [Start]0.1

    \[ x \cdot y + \left(z \cdot \left(z \cdot 3\right) + 0\right) \]

    rational_best_oopsla_all_46_json_45_simplify-85 [=>]0.1

    \[ x \cdot y + \color{blue}{z \cdot \left(z \cdot 3\right)} \]

    rational_best_oopsla_all_46_json_45_simplify-74 [=>]0.1

    \[ x \cdot y + z \cdot \color{blue}{\left(3 \cdot z\right)} \]
  5. Final simplification0.1

    \[\leadsto x \cdot y + z \cdot \left(3 \cdot z\right) \]

Alternatives

Alternative 1
Error23.7
Cost192
\[y \cdot x \]

Error

Reproduce?

herbie shell --seed 2023090 
(FPCore (x y z)
  :name "Linear.Quaternion:$c/ from linear-1.19.1.3, A"
  :precision binary64

  :herbie-target
  (+ (* (* 3.0 z) z) (* y x))

  (+ (+ (+ (* x y) (* z z)) (* z z)) (* z z)))