Average Error: 0.0 → 0.0
Time: 3.2s
Precision: binary64
Cost: 576
\[\left(d1 \cdot d2 + \left(d3 + 5\right) \cdot d1\right) + d1 \cdot 32\]
\[d1 \cdot d2 + d1 \cdot \left(d3 + 37\right)\]
\left(d1 \cdot d2 + \left(d3 + 5\right) \cdot d1\right) + d1 \cdot 32
d1 \cdot d2 + d1 \cdot \left(d3 + 37\right)
(FPCore (d1 d2 d3)
 :precision binary64
 (+ (+ (* d1 d2) (* (+ d3 5.0) d1)) (* d1 32.0)))
(FPCore (d1 d2 d3) :precision binary64 (+ (* d1 d2) (* d1 (+ d3 37.0))))
double code(double d1, double d2, double d3) {
	return ((d1 * d2) + ((d3 + 5.0) * d1)) + (d1 * 32.0);
}
double code(double d1, double d2, double d3) {
	return (d1 * d2) + (d1 * (d3 + 37.0));
}

Error

Bits error versus d1

Bits error versus d2

Bits error versus d3

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.0
Target0.0
Herbie0.0
\[d1 \cdot \left(\left(37 + d3\right) + d2\right)\]

Alternatives

Alternative 1
Error0.0
Cost448
\[d1 \cdot \left(d2 + \left(d3 + 37\right)\right)\]
Alternative 2
Error10.4
Cost1290
\[\begin{array}{l} \mathbf{if}\;d3 \leq -5.861009343968015 \cdot 10^{+87}:\\ \;\;\;\;d1 \cdot d3\\ \mathbf{elif}\;d3 \leq -4.002034046307147 \cdot 10^{+52}:\\ \;\;\;\;d1 \cdot d2\\ \mathbf{elif}\;d3 \leq -0.0016423919654486251 \lor \neg \left(d3 \leq 4.696201976590496 \cdot 10^{+155}\right):\\ \;\;\;\;d1 \cdot \left(d3 + 37\right)\\ \mathbf{else}:\\ \;\;\;\;d1 \cdot \left(d2 + 37\right)\\ \end{array}\]
Alternative 3
Error7.8
Cost648
\[\begin{array}{l} \mathbf{if}\;d2 \leq -2.563138542517937 \cdot 10^{+38} \lor \neg \left(d2 \leq 1.8913850711423397 \cdot 10^{+25}\right):\\ \;\;\;\;d1 \cdot d2\\ \mathbf{else}:\\ \;\;\;\;d1 \cdot \left(d3 + 37\right)\\ \end{array}\]
Alternative 4
Error29.9
Cost520
\[\begin{array}{l} \mathbf{if}\;d3 \leq -5.715384690321276 \cdot 10^{+87} \lor \neg \left(d3 \leq 4.696201976590496 \cdot 10^{+155}\right):\\ \;\;\;\;d1 \cdot d3\\ \mathbf{else}:\\ \;\;\;\;d1 \cdot d2\\ \end{array}\]
Alternative 5
Error40.9
Cost192
\[d1 \cdot d2\]
Alternative 6
Error61.7
Cost64
\[-1\]
Alternative 7
Error61.7
Cost64
\[1\]

Error

Derivation

  1. Initial program 0.0

    \[\left(d1 \cdot d2 + \left(d3 + 5\right) \cdot d1\right) + d1 \cdot 32\]
  2. Simplified0.0

    \[\leadsto \color{blue}{d1 \cdot \left(d2 + \left(d3 + 37\right)\right)}\]
  3. Using strategy rm
  4. Applied distribute-rgt-in_binary64_30970.0

    \[\leadsto \color{blue}{d2 \cdot d1 + \left(d3 + 37\right) \cdot d1}\]
  5. Simplified0.0

    \[\leadsto \color{blue}{d1 \cdot d2} + \left(d3 + 37\right) \cdot d1\]
  6. Simplified0.0

    \[\leadsto d1 \cdot d2 + \color{blue}{d1 \cdot \left(d3 + 37\right)}\]
  7. Simplified0.0

    \[\leadsto \color{blue}{d1 \cdot d2 + d1 \cdot \left(d3 + 37\right)}\]
  8. Final simplification0.0

    \[\leadsto d1 \cdot d2 + d1 \cdot \left(d3 + 37\right)\]

Reproduce

herbie shell --seed 2021044 
(FPCore (d1 d2 d3)
  :name "FastMath dist3"
  :precision binary64

  :herbie-target
  (* d1 (+ (+ 37.0 d3) d2))

  (+ (+ (* d1 d2) (* (+ d3 5.0) d1)) (* d1 32.0)))