Average Error: 0.0 → 0.0
Time: 4.1s
Precision: binary64
Cost: 448
\[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)\]
\[a \cdot \left(d + \left(c + b\right)\right)\]
a \cdot \left(\left(b + c\right) + d\right)
a \cdot \left(d + \left(c + b\right)\right)
(FPCore (a b c d) :precision binary64 (* a (+ (+ b c) d)))
(FPCore (a b c d) :precision binary64 (* a (+ d (+ c b))))
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 * (d + (c + b));
}

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)\]

Alternatives

Alternative 1
Error9.0
Cost969
\[\begin{array}{l} \mathbf{if}\;b \leq 9.47699046425201 \cdot 10^{-134}:\\ \;\;\;\;a \cdot c + a \cdot d\\ \mathbf{elif}\;b \leq 4.105778033834989 \cdot 10^{-72} \lor \neg \left(b \leq 1.4430552206509354 \cdot 10^{-33}\right):\\ \;\;\;\;a \cdot \left(c + b\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(d + b\right)\\ \end{array}\]
Alternative 2
Error9.0
Cost969
\[\begin{array}{l} \mathbf{if}\;b \leq 9.47699046425201 \cdot 10^{-134}:\\ \;\;\;\;a \cdot \left(d + c\right)\\ \mathbf{elif}\;b \leq 4.105778033834989 \cdot 10^{-72} \lor \neg \left(b \leq 1.4430552206509354 \cdot 10^{-33}\right):\\ \;\;\;\;a \cdot \left(c + b\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(d + b\right)\\ \end{array}\]
Alternative 3
Error10.8
Cost780
\[\begin{array}{l} \mathbf{if}\;c \leq 2.6106734504547696 \cdot 10^{-148} \lor \neg \left(c \leq 1.7044240459527901 \cdot 10^{-102}\right) \land c \leq 1.162900186891649 \cdot 10^{-76}:\\ \;\;\;\;a \cdot \left(d + b\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(c + b\right)\\ \end{array}\]
Alternative 4
Error13.9
Cost641
\[\begin{array}{l} \mathbf{if}\;d \leq 7.0293102230234446 \cdot 10^{-62}:\\ \;\;\;\;a \cdot \left(c + b\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot d\\ \end{array}\]
Alternative 5
Error29.7
Cost1797
\[\begin{array}{l} \mathbf{if}\;b \leq 1.0382906979803629 \cdot 10^{-283}:\\ \;\;\;\;a \cdot c\\ \mathbf{elif}\;b \leq 1.2085577424189088 \cdot 10^{-274}:\\ \;\;\;\;a \cdot d\\ \mathbf{elif}\;b \leq 1.0372729821035119 \cdot 10^{-258}:\\ \;\;\;\;a \cdot c\\ \mathbf{elif}\;b \leq 6.823316290593219 \cdot 10^{-160}:\\ \;\;\;\;a \cdot d\\ \mathbf{elif}\;b \leq 2.7784378368721608 \cdot 10^{-104}:\\ \;\;\;\;a \cdot c\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array}\]
Alternative 6
Error31.6
Cost652
\[\begin{array}{l} \mathbf{if}\;c \leq 2.6106734504547696 \cdot 10^{-148} \lor \neg \left(c \leq 1.0488276607418648 \cdot 10^{-93}\right) \land c \leq 3.133161448614818 \cdot 10^{-68}:\\ \;\;\;\;a \cdot d\\ \mathbf{else}:\\ \;\;\;\;a \cdot c\\ \end{array}\]
Alternative 7
Error41.3
Cost192
\[a \cdot d\]
Alternative 8
Error59.1
Cost64
\[1\]

Error

Derivation

  1. Initial program 0.0

    \[a \cdot \left(\left(b + c\right) + d\right)\]
  2. Simplified0.0

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

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

Reproduce

herbie shell --seed 2021044 
(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)))