Average Error: 11.0 → 3.5
Time: 20.2s
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;a1 \cdot \frac{a2}{b2} = -\infty:\\ \;\;\;\;\left(\frac{a1}{b1} \cdot a2\right) \cdot \frac{1}{b2}\\ \mathbf{if}\;a1 \cdot \frac{a2}{b2} \le -2.4836944614157392 \cdot 10^{-278}:\\ \;\;\;\;\left(a1 \cdot \frac{a2}{b2}\right) \cdot \frac{1}{b1}\\ \mathbf{if}\;a1 \cdot \frac{a2}{b2} \le 1.3466206452563338 \cdot 10^{-300}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{if}\;a1 \cdot \frac{a2}{b2} \le 1.2267898782513618 \cdot 10^{+248}:\\ \;\;\;\;\frac{a1 \cdot \frac{a2}{b2}}{b1}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Target

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

Derivation

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

    1. Initial program 14.5

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

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

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

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

    if (* a1 (/ a2 b2)) < -2.4836944614157392e-278

    1. Initial program 12.9

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

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

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

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

    if -2.4836944614157392e-278 < (* a1 (/ a2 b2)) < 1.3466206452563338e-300 or 1.2267898782513618e+248 < (* a1 (/ a2 b2))

    1. Initial program 7.6

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]

    if 1.3466206452563338e-300 < (* a1 (/ a2 b2)) < 1.2267898782513618e+248

    1. Initial program 12.2

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

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

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

Runtime

Time bar (total: 20.2s)Debug logProfile

herbie shell --seed '#(1064269945 2896236262 301053905 1701069080 1701464310 1614783279)' 
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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