Average Error: 10.6 → 2.9
Time: 34.3s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1}{\frac{b1}{a2}} = -\infty:\\ \;\;\;\;\frac{1}{\frac{\frac{b1}{\frac{a2}{b2}}}{a1}}\\ \mathbf{if}\;\frac{a1}{\frac{b1}{a2}} \le -4.309579007683647 \cdot 10^{-280}:\\ \;\;\;\;\frac{\frac{a1}{\frac{b1}{a2}}}{b2}\\ \mathbf{if}\;\frac{a1}{\frac{b1}{a2}} \le 4.2762448070001 \cdot 10^{-311}:\\ \;\;\;\;a1 \cdot \frac{a2}{b1 \cdot b2}\\ \mathbf{if}\;\frac{a1}{\frac{b1}{a2}} \le 4.207432435226591 \cdot 10^{+252}:\\ \;\;\;\;\frac{\frac{a1}{\frac{b1}{a2}}}{b2}\\ \mathbf{else}:\\ \;\;\;\;a1 \cdot \frac{a2}{b1 \cdot b2}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Target

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

Derivation

  1. Split input into 3 regimes
  2. if (/ a1 (/ b1 a2)) < -inf.0

    1. Initial program 14.6

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

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

      \[\leadsto \frac{a1}{\color{blue}{\frac{b1}{\frac{a2}{b2}}}}\]
    6. Using strategy rm
    7. Applied clear-num14.2

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

    if -inf.0 < (/ a1 (/ b1 a2)) < -4.309579007683647e-280 or 4.2762448070001e-311 < (/ a1 (/ b1 a2)) < 4.207432435226591e+252

    1. Initial program 12.3

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

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

      \[\leadsto \frac{a1}{\color{blue}{\frac{b1}{\frac{a2}{b2}}}}\]
    6. Using strategy rm
    7. Applied associate-/r/7.6

      \[\leadsto \frac{a1}{\color{blue}{\frac{b1}{a2} \cdot b2}}\]
    8. Applied associate-/r*0.5

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

    if -4.309579007683647e-280 < (/ a1 (/ b1 a2)) < 4.2762448070001e-311 or 4.207432435226591e+252 < (/ a1 (/ b1 a2))

    1. Initial program 6.9

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

      \[\leadsto \color{blue}{\frac{a1}{\frac{b1 \cdot b2}{a2}}}\]
    4. Using strategy rm
    5. Applied div-inv6.4

      \[\leadsto \color{blue}{a1 \cdot \frac{1}{\frac{b1 \cdot b2}{a2}}}\]
    6. Applied simplify6.1

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

Runtime

Time bar (total: 34.3s)Debug logProfile

herbie shell --seed '#(1071246582 2318319007 2683472949 3810440501 3233274817 2724848749)' 
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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