Average Error: 11.6 → 3.6
Time: 28.4s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1}{\frac{b1}{a2}} \le -1.0538430783977041 \cdot 10^{+248}:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \mathbf{if}\;\frac{a1}{\frac{b1}{a2}} \le -3.069604403649267 \cdot 10^{-275}:\\ \;\;\;\;\frac{\frac{a1}{\frac{b1}{a2}}}{b2}\\ \mathbf{if}\;\frac{a1}{\frac{b1}{a2}} \le 3.085021802936852 \cdot 10^{-290}:\\ \;\;\;\;a1 \cdot \frac{a2}{b1 \cdot b2}\\ \mathbf{if}\;\frac{a1}{\frac{b1}{a2}} \le 2.1922187956608556 \cdot 10^{+205}:\\ \;\;\;\;\frac{\frac{a1}{\frac{b1}{a2}}}{b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Target

Original11.6
Target11.1
Herbie3.6
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 4 regimes
  2. if (/ a1 (/ b1 a2)) < -1.0538430783977041e+248

    1. Initial program 16.3

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

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

    if -1.0538430783977041e+248 < (/ a1 (/ b1 a2)) < -3.069604403649267e-275 or 3.085021802936852e-290 < (/ a1 (/ b1 a2)) < 2.1922187956608556e+205

    1. Initial program 13.2

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

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

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

      \[\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 -3.069604403649267e-275 < (/ a1 (/ b1 a2)) < 3.085021802936852e-290

    1. Initial program 6.1

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

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

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

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

    if 2.1922187956608556e+205 < (/ a1 (/ b1 a2))

    1. Initial program 15.5

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Using strategy rm
    3. Applied times-frac15.6

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

Runtime

Time bar (total: 28.4s)Debug logProfile

herbie shell --seed '#(1072330854 3074818769 591214268 3603999196 3863745332 3332387116)' 
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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