?

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

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.1

    \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
  2. Simplified0.1

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

    [Start]0.1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternatives

Alternative 1
Error30.7
Cost1512
\[\begin{array}{l} \mathbf{if}\;y \leq -3.6 \cdot 10^{+39}:\\ \;\;\;\;2 \cdot y\\ \mathbf{elif}\;y \leq -5.6 \cdot 10^{-77}:\\ \;\;\;\;x \cdot 3\\ \mathbf{elif}\;y \leq -1.38 \cdot 10^{-161}:\\ \;\;\;\;z\\ \mathbf{elif}\;y \leq -9 \cdot 10^{-201}:\\ \;\;\;\;x \cdot 3\\ \mathbf{elif}\;y \leq -1.1 \cdot 10^{-291}:\\ \;\;\;\;z\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{-266}:\\ \;\;\;\;x \cdot 3\\ \mathbf{elif}\;y \leq 9.4 \cdot 10^{-194}:\\ \;\;\;\;z\\ \mathbf{elif}\;y \leq 6.8 \cdot 10^{-129}:\\ \;\;\;\;x \cdot 3\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+15}:\\ \;\;\;\;z\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{+66}:\\ \;\;\;\;x \cdot 3\\ \mathbf{else}:\\ \;\;\;\;2 \cdot y\\ \end{array} \]
Alternative 2
Error12.4
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{+148}:\\ \;\;\;\;x \cdot 3\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{+136}:\\ \;\;\;\;2 \cdot y + z\\ \mathbf{else}:\\ \;\;\;\;x \cdot 3\\ \end{array} \]
Alternative 3
Error9.6
Cost584
\[\begin{array}{l} t_0 := 2 \cdot y + z\\ \mathbf{if}\;y \leq -2.9 \cdot 10^{+48}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.65 \cdot 10^{+65}:\\ \;\;\;\;3 \cdot x + z\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error9.5
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -1.22 \cdot 10^{+70}:\\ \;\;\;\;x + 2 \cdot \left(y + x\right)\\ \mathbf{elif}\;y \leq 1.02 \cdot 10^{+65}:\\ \;\;\;\;3 \cdot x + z\\ \mathbf{else}:\\ \;\;\;\;2 \cdot y + z\\ \end{array} \]
Alternative 5
Error30.3
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -2.3 \cdot 10^{+68}:\\ \;\;\;\;2 \cdot y\\ \mathbf{elif}\;y \leq 1.06 \cdot 10^{+46}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;2 \cdot y\\ \end{array} \]
Alternative 6
Error41.9
Cost64
\[z \]

Error

Reproduce?

herbie shell --seed 2023074 
(FPCore (x y z)
  :name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendInside from plot-0.2.3.4"
  :precision binary64
  (+ (+ (+ (+ (+ x y) y) x) z) x))