Average Error: 10.7 → 2.4
Time: 25.3s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1}{\frac{b1}{\frac{a2}{b2}}} = -\infty:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\ \mathbf{if}\;\frac{a1}{\frac{b1}{\frac{a2}{b2}}} \le -2.9535131698709 \cdot 10^{-310}:\\ \;\;\;\;\frac{a1}{\frac{b1}{\frac{a2}{b2}}}\\ \mathbf{if}\;\frac{a1}{\frac{b1}{\frac{a2}{b2}}} \le 0.0:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\ \mathbf{if}\;\frac{a1}{\frac{b1}{\frac{a2}{b2}}} \le 1.8486198808339646 \cdot 10^{+246}:\\ \;\;\;\;\frac{a1}{\frac{b1}{\frac{a2}{b2}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Target

Original10.7
Target11.2
Herbie2.4
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 3 regimes
  2. if (/ a1 (/ b1 (/ a2 b2))) < -inf.0 or 1.8486198808339646e+246 < (/ a1 (/ b1 (/ a2 b2)))

    1. Initial program 14.0

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Using strategy rm
    3. Applied associate-/r*11.1

      \[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]

    if -inf.0 < (/ a1 (/ b1 (/ a2 b2))) < -2.9535131698709e-310 or 0.0 < (/ a1 (/ b1 (/ a2 b2))) < 1.8486198808339646e+246

    1. Initial program 14.0

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Using strategy rm
    3. Applied associate-/l*7.8

      \[\leadsto \color{blue}{\frac{a1}{\frac{b1 \cdot b2}{a2}}}\]
    4. Using strategy rm
    5. Applied associate-/l*0.8

      \[\leadsto \frac{a1}{\color{blue}{\frac{b1}{\frac{a2}{b2}}}}\]

    if -2.9535131698709e-310 < (/ a1 (/ b1 (/ a2 b2))) < 0.0

    1. Initial program 3.9

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Using strategy rm
    3. Applied associate-/r*2.2

      \[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 25.3s)Debug logProfile

herbie shell --seed '#(1071501266 3581234924 1086666455 2685055582 1243441566 1802958749)' +o rules:numerics
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

  :herbie-target
  (* (/ a1 b1) (/ a2 b2))

  (/ (* a1 a2) (* b1 b2)))