Average Error: 11.5 → 3.4
Time: 27.2s
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\frac{a2}{b1}}{b2} = -\infty:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\ \mathbf{if}\;\frac{\frac{a2}{b1}}{b2} \le -7.182581307675307 \cdot 10^{-221}:\\ \;\;\;\;a1 \cdot \frac{\frac{a2}{b1}}{b2}\\ \mathbf{if}\;\frac{\frac{a2}{b1}}{b2} \le 0.0:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \mathbf{if}\;\frac{\frac{a2}{b1}}{b2} \le 1.9621917891380246 \cdot 10^{+286}:\\ \;\;\;\;a1 \cdot \frac{\frac{a2}{b1}}{b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\frac{b1 \cdot b2}{a1}}}{\frac{1}{a2}}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Target

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

Derivation

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

    1. Initial program 13.7

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

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

    if (/ (/ a2 b1) b2) < -7.182581307675307e-221 or 0.0 < (/ (/ a2 b1) b2) < 1.9621917891380246e+286

    1. Initial program 13.6

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

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

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

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

    if -7.182581307675307e-221 < (/ (/ a2 b1) b2) < 0.0

    1. Initial program 6.3

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

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

    if 1.9621917891380246e+286 < (/ (/ a2 b1) b2)

    1. Initial program 14.0

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{a1}{b1 \cdot b2}}{\frac{1}{a2}}}\]
    7. Using strategy rm
    8. Applied clear-num15.0

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

Runtime

Time bar (total: 27.2s)Debug logProfile

herbie shell --seed '#(1064173506 2580572819 2847706409 4129882574 1125180799 1845288547)' +o rules:numerics
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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