Average Error: 11.2 → 3.4
Time: 29.2s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1}{b2 \cdot \frac{b1}{a2}} = -\infty:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \mathbf{if}\;\frac{a1}{b2 \cdot \frac{b1}{a2}} \le -2.3347233562848018 \cdot 10^{-306}:\\ \;\;\;\;\frac{a1}{b2 \cdot \frac{b1}{a2}}\\ \mathbf{if}\;\frac{a1}{b2 \cdot \frac{b1}{a2}} \le 0.0:\\ \;\;\;\;\frac{a1 \cdot a2}{b1} \cdot \frac{1}{b2}\\ \mathbf{if}\;\frac{a1}{b2 \cdot \frac{b1}{a2}} \le 8.390510085232154 \cdot 10^{+283}:\\ \;\;\;\;\frac{a1}{b2 \cdot \frac{b1}{a2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1} \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.2
Target11.1
Herbie3.4
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 3 regimes
  2. if (/ a1 (* b2 (/ b1 a2))) < -inf.0

    1. Initial program 13.8

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

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

    if -inf.0 < (/ a1 (* b2 (/ b1 a2))) < -2.3347233562848018e-306 or 0.0 < (/ a1 (* b2 (/ b1 a2))) < 8.390510085232154e+283

    1. Initial program 14.6

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

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

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

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

    if -2.3347233562848018e-306 < (/ a1 (* b2 (/ b1 a2))) < 0.0 or 8.390510085232154e+283 < (/ a1 (* b2 (/ b1 a2)))

    1. Initial program 5.8

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

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

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

Runtime

Time bar (total: 29.2s)Debug logProfile

herbie shell --seed '#(1072840222 1305617769 1692503039 1353360431 4178980589 1488672652)' 
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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