Expression 2, p15

?

Percentage Accurate: 100.0% → 100.0%
Time: 1.4s
Precision: binary64
Cost: 320

?

\[0 \leq x \land x \leq 2\]
\[x + x \cdot x \]
\[x + x \cdot x \]
(FPCore (x) :precision binary64 (+ x (* x x)))
(FPCore (x) :precision binary64 (+ x (* x x)))
double code(double x) {
	return x + (x * x);
}
double code(double x) {
	return x + (x * x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = x + (x * x)
end function
real(8) function code(x)
    real(8), intent (in) :: x
    code = x + (x * x)
end function
public static double code(double x) {
	return x + (x * x);
}
public static double code(double x) {
	return x + (x * x);
}
def code(x):
	return x + (x * x)
def code(x):
	return x + (x * x)
function code(x)
	return Float64(x + Float64(x * x))
end
function code(x)
	return Float64(x + Float64(x * x))
end
function tmp = code(x)
	tmp = x + (x * x);
end
function tmp = code(x)
	tmp = x + (x * x);
end
code[x_] := N[(x + N[(x * x), $MachinePrecision]), $MachinePrecision]
code[x_] := N[(x + N[(x * x), $MachinePrecision]), $MachinePrecision]
x + x \cdot x
x + x \cdot x

Local Percentage Accuracy?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Bogosity?

Bogosity

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original100.0%
Target100.0%
Herbie100.0%
\[\left(1 + x\right) \cdot x \]

Derivation?

  1. Initial program 100.0%

    \[x + x \cdot x \]
  2. Final simplification100.0%

    \[\leadsto x + x \cdot x \]

Reproduce?

herbie shell --seed 2023161 
(FPCore (x)
  :name "Expression 2, p15"
  :precision binary64
  :pre (and (<= 0.0 x) (<= x 2.0))

  :herbie-target
  (* (+ 1.0 x) x)

  (+ x (* x x)))