Average Error: 11.1 → 3.0
Time: 20.2s
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1}{\frac{b1 \cdot b2}{a2}} = -\infty:\\ \;\;\;\;\left(\frac{a1}{b1} \cdot a2\right) \cdot \frac{1}{b2}\\ \mathbf{if}\;\frac{a1}{\frac{b1 \cdot b2}{a2}} \le -3.4958881742666794 \cdot 10^{-307}:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \mathbf{if}\;\frac{a1}{\frac{b1 \cdot b2}{a2}} \le 1.167027223867145 \cdot 10^{-289}:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \mathbf{if}\;\frac{a1}{\frac{b1 \cdot b2}{a2}} \le 9.337502856895984 \cdot 10^{+265}:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \mathbf{else}:\\ \;\;\;\;\left(a1 \cdot \frac{a2}{b1}\right) \cdot \frac{1}{b2}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Target

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

Derivation

  1. Split input into 4 regimes
  2. if (/ a1 (/ (* b1 b2) a2))

    1. Initial program 36.4

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

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

      \[\leadsto \frac{a1}{b1} \cdot \color{blue}{\left(a2 \cdot \frac{1}{b2}\right)}\]
    6. Applied associate-*r*6.8

      \[\leadsto \color{blue}{\left(\frac{a1}{b1} \cdot a2\right) \cdot \frac{1}{b2}}\]

    if (/ a1 (/ (* b1 b2) a2)) < -3.4958881742666794e-307 or 1.167027223867145e-289 < (/ a1 (/ (* b1 b2) a2)) < 9.337502856895984e+265

    1. Initial program 7.2

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

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

    if -3.4958881742666794e-307 < (/ a1 (/ (* b1 b2) a2)) < 1.167027223867145e-289

    1. Initial program 10.9

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

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

    if 9.337502856895984e+265 < (/ a1 (/ (* b1 b2) a2))

    1. Initial program 31.6

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

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

      \[\leadsto \color{blue}{\left(a1 \cdot \frac{1}{b1}\right)} \cdot \frac{a2}{b2}\]
    6. Applied associate-*l*29.3

      \[\leadsto \color{blue}{a1 \cdot \left(\frac{1}{b1} \cdot \frac{a2}{b2}\right)}\]
    7. Applied simplify28.1

      \[\leadsto a1 \cdot \color{blue}{\frac{\frac{a2}{b1}}{b2}}\]
    8. Using strategy rm
    9. Applied div-inv28.1

      \[\leadsto a1 \cdot \color{blue}{\left(\frac{a2}{b1} \cdot \frac{1}{b2}\right)}\]
    10. Applied associate-*r*15.6

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

Runtime

Time bar (total: 20.2s)Debug logProfile

herbie shell --seed '#(1070131407 1246090267 3027482374 2150728003 2026520792 2347815650)' 
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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