Average Error: 10.9 → 3.2
Time: 22.2s
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1}{\frac{b1 \cdot b2}{a2}} = -\infty:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \mathbf{if}\;\frac{a1}{\frac{b1 \cdot b2}{a2}} \le -8.076390584628404 \cdot 10^{-276}:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \mathbf{if}\;\frac{a1}{\frac{b1 \cdot b2}{a2}} \le -0.0:\\ \;\;\;\;\frac{a1 \cdot \frac{a2}{b2}}{b1}\\ \mathbf{if}\;\frac{a1}{\frac{b1 \cdot b2}{a2}} \le 2.733858414759234 \cdot 10^{+282}:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{a1}{b1} \cdot a2\right) \cdot \frac{1}{b2}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Target

Original10.9
Target10.6
Herbie3.2
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

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

    1. Initial program 38.4

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

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

    if -inf.0 < (/ a1 (/ (* b1 b2) a2)) < -8.076390584628404e-276 or -0.0 < (/ a1 (/ (* b1 b2) a2)) < 2.733858414759234e+282

    1. Initial program 7.4

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

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

    if -8.076390584628404e-276 < (/ a1 (/ (* b1 b2) a2)) < -0.0

    1. Initial program 10.3

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

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

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

    if 2.733858414759234e+282 < (/ a1 (/ (* b1 b2) a2))

    1. Initial program 32.3

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

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

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

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

Runtime

Time bar (total: 22.2s)Debug logProfile

herbie shell --seed '#(1070864556 424010669 783715395 1203517814 4070606583 4107618214)' +o rules:numerics
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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