Average Error: 11.2 → 3.5
Time: 37.7s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1}{b1} \cdot a2 \le -5.505268534644017 \cdot 10^{+219}:\\ \;\;\;\;a1 \cdot \frac{\frac{a2}{b2}}{b1}\\ \mathbf{if}\;\frac{a1}{b1} \cdot a2 \le -2.631708285375282 \cdot 10^{-224}:\\ \;\;\;\;\left(\frac{a1}{b1} \cdot a2\right) \cdot \frac{1}{b2}\\ \mathbf{if}\;\frac{a1}{b1} \cdot a2 \le 1.4821475551002457 \cdot 10^{-297}:\\ \;\;\;\;a1 \cdot \frac{\frac{a2}{b2}}{b1}\\ \mathbf{if}\;\frac{a1}{b1} \cdot a2 \le 5.912666292838447 \cdot 10^{+288}:\\ \;\;\;\;\left(\frac{a1}{b1} \cdot a2\right) \cdot \frac{1}{b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original11.2
Target10.7
Herbie3.5
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 4 regimes
  2. if (* (/ a1 b1) a2) < -5.505268534644017e+219

    1. Initial program 16.5

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

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

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

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

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

    if -5.505268534644017e+219 < (* (/ a1 b1) a2) < -2.631708285375282e-224 or 1.4821475551002457e-297 < (* (/ a1 b1) a2) < 5.912666292838447e+288

    1. Initial program 12.8

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

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

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

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

    if -2.631708285375282e-224 < (* (/ a1 b1) a2) < 1.4821475551002457e-297

    1. Initial program 5.9

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

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

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

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

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

    if 5.912666292838447e+288 < (* (/ a1 b1) a2)

    1. Initial program 16.7

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

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

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

      \[\leadsto \color{blue}{\left(\frac{a1}{b1} \cdot a2\right) \cdot \frac{1}{b2}}\]
    7. Taylor expanded around 0 35.1

      \[\leadsto \color{blue}{\frac{a1 \cdot a2}{b1}} \cdot \frac{1}{b2}\]
    8. Applied simplify15.9

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

Runtime

Time bar (total: 37.7s)Debug logProfile

herbie shell --seed 2020178 +o rules:numerics
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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