Average Error: 0.3 → 0
Time: 453.0ms
Precision: binary64
\[d \cdot 10 + d \cdot 20\]
\[d \cdot \left(10 + 20\right)\]
d \cdot 10 + d \cdot 20
d \cdot \left(10 + 20\right)
double code(double d) {
	return ((double) (((double) (d * 10.0)) + ((double) (d * 20.0))));
}
double code(double d) {
	return ((double) (d * ((double) (10.0 + 20.0))));
}

Error

Bits error versus d

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.3
Target0
Herbie0
\[d \cdot 30\]

Derivation

  1. Initial program 0.3

    \[d \cdot 10 + d \cdot 20\]
  2. Simplified0

    \[\leadsto \color{blue}{d \cdot \left(10 + 20\right)}\]
  3. Final simplification0

    \[\leadsto d \cdot \left(10 + 20\right)\]

Reproduce

herbie shell --seed 2020169 
(FPCore (d)
  :name "FastMath test1"
  :precision binary64

  :herbie-target
  (* d 30.0)

  (+ (* d 10.0) (* d 20.0)))