?

Average Error: 0.1 → 0.1
Time: 12.7s
Precision: binary64
Cost: 832

?

\[\left(\left(x \cdot y + z \cdot z\right) + z \cdot z\right) + z \cdot z \]
\[\left(z \cdot z + y \cdot x\right) - \left(z \cdot z\right) \cdot -2 \]
(FPCore (x y z)
 :precision binary64
 (+ (+ (+ (* x y) (* z z)) (* z z)) (* z z)))
(FPCore (x y z) :precision binary64 (- (+ (* z z) (* y x)) (* (* z z) -2.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 ((z * z) + (y * x)) - ((z * z) * -2.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 = ((z * z) + (y * x)) - ((z * z) * (-2.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 ((z * z) + (y * x)) - ((z * z) * -2.0);
}
def code(x, y, z):
	return (((x * y) + (z * z)) + (z * z)) + (z * z)
def code(x, y, z):
	return ((z * z) + (y * x)) - ((z * z) * -2.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(Float64(z * z) + Float64(y * x)) - Float64(Float64(z * z) * -2.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 = ((z * z) + (y * x)) - ((z * z) * -2.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[(N[(z * z), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision] - N[(N[(z * z), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot y + z \cdot z\right) + z \cdot z\right) + z \cdot z
\left(z \cdot z + y \cdot x\right) - \left(z \cdot z\right) \cdot -2

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 + \left(z \cdot \left(z + z\right) + z \cdot z\right)} \]
    Proof

    [Start]0.1

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

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

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

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

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

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

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

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

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

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

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

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

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

    [Start]0.1

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

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

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

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

Alternatives

Alternative 1
Error11.0
Cost584
\[\begin{array}{l} t_0 := 3 \cdot \left(z \cdot z\right)\\ \mathbf{if}\;z \leq -8 \cdot 10^{-43}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 2.7 \cdot 10^{-45}:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error0.1
Cost576
\[y \cdot x - z \cdot \left(z \cdot -3\right) \]
Alternative 3
Error0.1
Cost576
\[y \cdot x - \left(z \cdot z\right) \cdot -3 \]
Alternative 4
Error24.5
Cost192
\[y \cdot x \]

Error

Reproduce?

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