?

Average Error: 0.1 → 0.1
Time: 13.5s
Precision: binary64
Cost: 960

?

\[x \cdot \left(y + z\right) + z \cdot 5 \]
\[\left(z \cdot \left(5 + x\right) + y \cdot \left(x \cdot 2\right)\right) - y \cdot x \]
(FPCore (x y z) :precision binary64 (+ (* x (+ y z)) (* z 5.0)))
(FPCore (x y z)
 :precision binary64
 (- (+ (* z (+ 5.0 x)) (* y (* x 2.0))) (* y x)))
double code(double x, double y, double z) {
	return (x * (y + z)) + (z * 5.0);
}
double code(double x, double y, double z) {
	return ((z * (5.0 + x)) + (y * (x * 2.0))) - (y * x);
}
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 * 5.0d0)
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 * (5.0d0 + x)) + (y * (x * 2.0d0))) - (y * x)
end function
public static double code(double x, double y, double z) {
	return (x * (y + z)) + (z * 5.0);
}
public static double code(double x, double y, double z) {
	return ((z * (5.0 + x)) + (y * (x * 2.0))) - (y * x);
}
def code(x, y, z):
	return (x * (y + z)) + (z * 5.0)
def code(x, y, z):
	return ((z * (5.0 + x)) + (y * (x * 2.0))) - (y * x)
function code(x, y, z)
	return Float64(Float64(x * Float64(y + z)) + Float64(z * 5.0))
end
function code(x, y, z)
	return Float64(Float64(Float64(z * Float64(5.0 + x)) + Float64(y * Float64(x * 2.0))) - Float64(y * x))
end
function tmp = code(x, y, z)
	tmp = (x * (y + z)) + (z * 5.0);
end
function tmp = code(x, y, z)
	tmp = ((z * (5.0 + x)) + (y * (x * 2.0))) - (y * x);
end
code[x_, y_, z_] := N[(N[(x * N[(y + z), $MachinePrecision]), $MachinePrecision] + N[(z * 5.0), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(N[(N[(z * N[(5.0 + x), $MachinePrecision]), $MachinePrecision] + N[(y * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * x), $MachinePrecision]), $MachinePrecision]
x \cdot \left(y + z\right) + z \cdot 5
\left(z \cdot \left(5 + x\right) + y \cdot \left(x \cdot 2\right)\right) - y \cdot x

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation?

  1. Initial program 0.1

    \[x \cdot \left(y + z\right) + z \cdot 5 \]
  2. Applied egg-rr29.9

    \[\leadsto \color{blue}{\frac{1}{x \cdot \left(y + z\right) + z \cdot 5} \cdot \left(\left(x \cdot \left(y + z\right) + z \cdot 5\right) \cdot \left(x \cdot \left(y + z\right) + z \cdot 5\right)\right)} \]
  3. Taylor expanded in y around 0 43.4

    \[\leadsto \frac{1}{x \cdot \left(y + z\right) + z \cdot 5} \cdot \color{blue}{\left({\left(z \cdot x + 5 \cdot z\right)}^{2} + 2 \cdot \left(y \cdot \left(\left(z \cdot x + 5 \cdot z\right) \cdot x\right)\right)\right)} \]
  4. Simplified42.8

    \[\leadsto \frac{1}{x \cdot \left(y + z\right) + z \cdot 5} \cdot \color{blue}{\left({\left(z \cdot \left(5 + x\right)\right)}^{2} + 2 \cdot \left(\left(z \cdot \left(5 + x\right)\right) \cdot \left(y \cdot x\right)\right)\right)} \]
    Proof

    [Start]43.4

    \[ \frac{1}{x \cdot \left(y + z\right) + z \cdot 5} \cdot \left({\left(z \cdot x + 5 \cdot z\right)}^{2} + 2 \cdot \left(y \cdot \left(\left(z \cdot x + 5 \cdot z\right) \cdot x\right)\right)\right) \]

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

    \[ \frac{1}{x \cdot \left(y + z\right) + z \cdot 5} \cdot \left({\color{blue}{\left(z \cdot \left(5 + x\right)\right)}}^{2} + 2 \cdot \left(y \cdot \left(\left(z \cdot x + 5 \cdot z\right) \cdot x\right)\right)\right) \]

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

    \[ \frac{1}{x \cdot \left(y + z\right) + z \cdot 5} \cdot \left({\left(z \cdot \left(5 + x\right)\right)}^{2} + 2 \cdot \left(y \cdot \color{blue}{\left(x \cdot \left(z \cdot x + 5 \cdot z\right)\right)}\right)\right) \]

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

    \[ \frac{1}{x \cdot \left(y + z\right) + z \cdot 5} \cdot \left({\left(z \cdot \left(5 + x\right)\right)}^{2} + 2 \cdot \left(y \cdot \left(x \cdot \color{blue}{\left(z \cdot \left(5 + x\right)\right)}\right)\right)\right) \]

    rational.json-simplify-43 [=>]44.2

    \[ \frac{1}{x \cdot \left(y + z\right) + z \cdot 5} \cdot \left({\left(z \cdot \left(5 + x\right)\right)}^{2} + 2 \cdot \left(y \cdot \color{blue}{\left(z \cdot \left(\left(5 + x\right) \cdot x\right)\right)}\right)\right) \]

    rational.json-simplify-43 [<=]43.4

    \[ \frac{1}{x \cdot \left(y + z\right) + z \cdot 5} \cdot \left({\left(z \cdot \left(5 + x\right)\right)}^{2} + 2 \cdot \left(y \cdot \color{blue}{\left(x \cdot \left(z \cdot \left(5 + x\right)\right)\right)}\right)\right) \]

    rational.json-simplify-47 [<=]43.4

    \[ \frac{1}{x \cdot \left(y + z\right) + z \cdot 5} \cdot \left({\left(z \cdot \left(5 + x\right)\right)}^{2} + 2 \cdot \left(y \cdot \left(x \cdot \color{blue}{\left(z \cdot x + 5 \cdot z\right)}\right)\right)\right) \]

    rational.json-simplify-43 [<=]42.8

    \[ \frac{1}{x \cdot \left(y + z\right) + z \cdot 5} \cdot \left({\left(z \cdot \left(5 + x\right)\right)}^{2} + 2 \cdot \color{blue}{\left(\left(z \cdot x + 5 \cdot z\right) \cdot \left(y \cdot x\right)\right)}\right) \]

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

    \[ \frac{1}{x \cdot \left(y + z\right) + z \cdot 5} \cdot \left({\left(z \cdot \left(5 + x\right)\right)}^{2} + 2 \cdot \left(\color{blue}{\left(z \cdot \left(5 + x\right)\right)} \cdot \left(y \cdot x\right)\right)\right) \]
  5. Taylor expanded in z around inf 0.1

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

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

    [Start]0.1

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

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

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

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

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

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

Alternatives

Alternative 1
Error26.1
Cost1248
\[\begin{array}{l} \mathbf{if}\;z \leq -0.72:\\ \;\;\;\;5 \cdot z\\ \mathbf{elif}\;z \leq -1.05 \cdot 10^{-65}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -8.6 \cdot 10^{-79}:\\ \;\;\;\;5 \cdot z\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-156}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;z \leq 10^{-122}:\\ \;\;\;\;5 \cdot z\\ \mathbf{elif}\;z \leq 1.12 \cdot 10^{-100}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;z \leq 3.7 \cdot 10^{-73}:\\ \;\;\;\;5 \cdot z\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{-20}:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;5 \cdot z\\ \end{array} \]
Alternative 2
Error14.2
Cost1112
\[\begin{array}{l} t_0 := z \cdot \left(5 + x\right)\\ t_1 := \left(z + y\right) \cdot x\\ \mathbf{if}\;z \leq -2.25 \cdot 10^{-76}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{-155}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.32 \cdot 10^{-129}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{-97}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;z \leq 1.15 \cdot 10^{-71}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{-19}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error25.4
Cost984
\[\begin{array}{l} \mathbf{if}\;z \leq -1.95 \cdot 10^{-78}:\\ \;\;\;\;5 \cdot z\\ \mathbf{elif}\;z \leq 8.6 \cdot 10^{-156}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{-130}:\\ \;\;\;\;5 \cdot z\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{-101}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;z \leq 1.15 \cdot 10^{-73}:\\ \;\;\;\;5 \cdot z\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-17}:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;5 \cdot z\\ \end{array} \]
Alternative 4
Error16.3
Cost848
\[\begin{array}{l} t_0 := z \cdot \left(5 + x\right)\\ \mathbf{if}\;z \leq -9.8 \cdot 10^{-86}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 3 \cdot 10^{-156}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{-126}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{-97}:\\ \;\;\;\;y \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error0.1
Cost576
\[x \cdot \left(y + z\right) + z \cdot 5 \]
Alternative 6
Error34.6
Cost192
\[5 \cdot z \]

Error

Reproduce?

herbie shell --seed 2023077 
(FPCore (x y z)
  :name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, C"
  :precision binary64

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

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