Average Error: 0.0 → 0.0
Time: 1.8s
Precision: binary64
Cost: 576
\[x + y \cdot \left(z + x\right) \]
\[x + \left(y \cdot z + x \cdot y\right) \]
(FPCore (x y z) :precision binary64 (+ x (* y (+ z x))))
(FPCore (x y z) :precision binary64 (+ x (+ (* y z) (* x y))))
double code(double x, double y, double z) {
	return x + (y * (z + x));
}
double code(double x, double y, double z) {
	return x + ((y * z) + (x * y));
}
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 + x))
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) + (x * y))
end function
public static double code(double x, double y, double z) {
	return x + (y * (z + x));
}
public static double code(double x, double y, double z) {
	return x + ((y * z) + (x * y));
}
def code(x, y, z):
	return x + (y * (z + x))
def code(x, y, z):
	return x + ((y * z) + (x * y))
function code(x, y, z)
	return Float64(x + Float64(y * Float64(z + x)))
end
function code(x, y, z)
	return Float64(x + Float64(Float64(y * z) + Float64(x * y)))
end
function tmp = code(x, y, z)
	tmp = x + (y * (z + x));
end
function tmp = code(x, y, z)
	tmp = x + ((y * z) + (x * y));
end
code[x_, y_, z_] := N[(x + N[(y * N[(z + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(x + N[(N[(y * z), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + y \cdot \left(z + x\right)
x + \left(y \cdot z + x \cdot y\right)

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[x + y \cdot \left(z + x\right) \]
  2. Taylor expanded in z around 0 0.0

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

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

Alternatives

Alternative 1
Error7.3
Cost585
\[\begin{array}{l} \mathbf{if}\;z \leq -9 \cdot 10^{-83} \lor \neg \left(z \leq 8.6 \cdot 10^{-157}\right):\\ \;\;\;\;x + y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + x \cdot y\\ \end{array} \]
Alternative 2
Error24.3
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -6.4 \cdot 10^{-9}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
Alternative 3
Error0.0
Cost448
\[x + y \cdot \left(x + z\right) \]
Alternative 4
Error23.4
Cost320
\[x + x \cdot y \]
Alternative 5
Error34.8
Cost64
\[x \]

Error

Reproduce

herbie shell --seed 2022354 
(FPCore (x y z)
  :name "Main:bigenough2 from A"
  :precision binary64
  (+ x (* y (+ z x))))