Average Error: 11.2 → 2.9
Time: 30.4s
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\frac{a2}{b2}}{\frac{b1}{a1}} = -\infty:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \mathbf{if}\;\frac{\frac{a2}{b2}}{\frac{b1}{a1}} \le -3.593594498071279 \cdot 10^{-303}:\\ \;\;\;\;\frac{\frac{a2}{b2}}{\frac{b1}{a1}}\\ \mathbf{if}\;\frac{\frac{a2}{b2}}{\frac{b1}{a1}} \le -0.0:\\ \;\;\;\;\frac{1}{\frac{b1 \cdot b2}{a1 \cdot a2}}\\ \mathbf{if}\;\frac{\frac{a2}{b2}}{\frac{b1}{a1}} \le 8.110972262504896 \cdot 10^{+296}:\\ \;\;\;\;\frac{\frac{a2}{b2}}{\frac{b1}{a1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a1}{\frac{b1}{a2}}}{b2}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Target

Original11.2
Target11.0
Herbie2.9
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

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

    1. Initial program 9.7

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

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

    if -inf.0 < (/ (/ a2 b2) (/ b1 a1)) < -3.593594498071279e-303 or -0.0 < (/ (/ a2 b2) (/ b1 a1)) < 8.110972262504896e+296

    1. Initial program 16.6

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

      \[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
    4. Using strategy rm
    5. Applied add-cube-cbrt15.6

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{\frac{a1 \cdot a2}{b1}}{b2}} \cdot \sqrt[3]{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\right) \cdot \sqrt[3]{\frac{\frac{a1 \cdot a2}{b1}}{b2}}}\]
    6. Taylor expanded around 0 21.3

      \[\leadsto \left(\sqrt[3]{\frac{\frac{a1 \cdot a2}{b1}}{b2}} \cdot \sqrt[3]{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\right) \cdot \sqrt[3]{\color{blue}{\frac{a2 \cdot a1}{b1 \cdot b2}}}\]
    7. Applied simplify0.8

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

    if -3.593594498071279e-303 < (/ (/ a2 b2) (/ b1 a1)) < -0.0

    1. Initial program 2.5

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Using strategy rm
    3. Applied clear-num3.1

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

    if 8.110972262504896e+296 < (/ (/ a2 b2) (/ b1 a1))

    1. Initial program 6.7

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

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

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

Runtime

Time bar (total: 30.4s)Debug logProfile

herbie shell --seed '#(1070578969 3140398606 632207097 462683394 1189254563 964980650)' 
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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