?

Average Error: 0.1 → 0.1
Time: 6.9s
Precision: binary64
Cost: 704

?

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

    [Start]0.1

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

    rational_best-simplify-1 [=>]0.1

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

    rational_best-simplify-1 [=>]0.1

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

    rational_best-simplify-43 [=>]0.1

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

    rational_best-simplify-1 [=>]0.1

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

    rational_best-simplify-1 [=>]0.1

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

    rational_best-simplify-43 [=>]0.1

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

    rational_best-simplify-47 [=>]0.1

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

    rational_best-simplify-47 [=>]0.1

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

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

Alternatives

Alternative 1
Error11.4
Cost848
\[\begin{array}{l} t_0 := 3 \cdot \left(z \cdot z\right)\\ \mathbf{if}\;z \leq -1.85 \cdot 10^{-14}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{-87}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;z \leq 3 \cdot 10^{-64}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{+14}:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error11.4
Cost848
\[\begin{array}{l} t_0 := z \cdot \left(3 \cdot z\right)\\ \mathbf{if}\;z \leq -5 \cdot 10^{-11}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 3.8 \cdot 10^{-87}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{-64}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{+14}:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;3 \cdot \left(z \cdot z\right)\\ \end{array} \]
Alternative 3
Error0.1
Cost576
\[y \cdot x + 3 \cdot \left(z \cdot z\right) \]
Alternative 4
Error24.1
Cost192
\[y \cdot x \]

Error

Reproduce?

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