Average Error: 0.0 → 0.0
Time: 1.6s
Precision: binary64
\[56789 \leq a \land a \leq 98765 \land 0 \leq b \land b \leq 1 \land 0 \leq c \land c \leq 0.0016773 \land 0 \leq d \land d \leq 0.0016773\]
\[a \cdot \left(\left(b + c\right) + d\right)\]
\[\left(a \cdot b + a \cdot c\right) + a \cdot d\]
a \cdot \left(\left(b + c\right) + d\right)
\left(a \cdot b + a \cdot c\right) + a \cdot d
(FPCore (a b c d) :precision binary64 (* a (+ (+ b c) d)))
(FPCore (a b c d) :precision binary64 (+ (+ (* a b) (* a c)) (* a d)))
double code(double a, double b, double c, double d) {
	return a * ((b + c) + d);
}
double code(double a, double b, double c, double d) {
	return ((a * b) + (a * c)) + (a * d);
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.0
Target0.0
Herbie0.0
\[a \cdot b + a \cdot \left(c + d\right)\]

Derivation

  1. Initial program 0.0

    \[a \cdot \left(\left(b + c\right) + d\right)\]
  2. Using strategy rm
  3. Applied distribute-rgt-in_binary64_6330.0

    \[\leadsto \color{blue}{\left(b + c\right) \cdot a + d \cdot a}\]
  4. Simplified0.0

    \[\leadsto \color{blue}{a \cdot \left(b + c\right)} + d \cdot a\]
  5. Simplified0.0

    \[\leadsto a \cdot \left(b + c\right) + \color{blue}{a \cdot d}\]
  6. Using strategy rm
  7. Applied distribute-rgt-in_binary64_6330.0

    \[\leadsto \color{blue}{\left(b \cdot a + c \cdot a\right)} + a \cdot d\]
  8. Simplified0.0

    \[\leadsto \left(\color{blue}{a \cdot b} + c \cdot a\right) + a \cdot d\]
  9. Simplified0.0

    \[\leadsto \left(a \cdot b + \color{blue}{a \cdot c}\right) + a \cdot d\]
  10. Final simplification0.0

    \[\leadsto \left(a \cdot b + a \cdot c\right) + a \cdot d\]

Reproduce

herbie shell --seed 2020233 
(FPCore (a b c d)
  :name "Expression, p14"
  :precision binary64
  :pre (and (<= 56789.0 a 98765.0) (<= 0.0 b 1.0) (<= 0.0 c 0.0016773) (<= 0.0 d 0.0016773))

  :herbie-target
  (+ (* a b) (* a (+ c d)))

  (* a (+ (+ b c) d)))