?

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

?

\[\left(\left(x \cdot y + z \cdot z\right) + z \cdot z\right) + z \cdot z \]
\[y \cdot x + z \cdot \left(z \cdot 3\right) \]
(FPCore (x y z)
 :precision binary64
 (+ (+ (+ (* x y) (* z z)) (* z z)) (* z z)))
(FPCore (x y z) :precision binary64 (+ (* y x) (* z (* z 3.0))))
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 (y * x) + (z * (z * 3.0));
}
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 = (y * x) + (z * (z * 3.0d0))
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 (y * x) + (z * (z * 3.0));
}
def code(x, y, z):
	return (((x * y) + (z * z)) + (z * z)) + (z * z)
def code(x, y, z):
	return (y * x) + (z * (z * 3.0))
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(y * x) + Float64(z * Float64(z * 3.0)))
end
function tmp = code(x, y, z)
	tmp = (((x * y) + (z * z)) + (z * z)) + (z * z);
end
function tmp = code(x, y, z)
	tmp = (y * x) + (z * (z * 3.0));
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[(y * x), $MachinePrecision] + N[(z * N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot y + z \cdot z\right) + z \cdot z\right) + z \cdot z
y \cdot x + z \cdot \left(z \cdot 3\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. Applied egg-rr0.1

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

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

    [Start]0.1

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

    rational.json-simplify-5 [=>]0.1

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

    rational.json-simplify-2 [=>]0.1

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

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

Alternatives

Alternative 1
Error11.1
Cost584
\[\begin{array}{l} t_0 := 3 \cdot \left(z \cdot z\right)\\ \mathbf{if}\;z \leq -8500000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 2.65 \cdot 10^{-20}:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error11.0
Cost584
\[\begin{array}{l} \mathbf{if}\;z \leq -14000000:\\ \;\;\;\;3 \cdot \left(z \cdot z\right)\\ \mathbf{elif}\;z \leq 4 \cdot 10^{-20}:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(3 \cdot z\right)\\ \end{array} \]
Alternative 3
Error23.7
Cost192
\[y \cdot x \]

Error

Reproduce?

herbie shell --seed 2023075 
(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)))