Average Error: 10.6 → 3.9
Time: 33.7s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{b1}{\frac{a2}{b2}} \le -2.45747023661579 \cdot 10^{+162}:\\ \;\;\;\;\frac{\frac{a1}{b1 \cdot b2}}{\frac{1}{a2}}\\ \mathbf{if}\;\frac{b1}{\frac{a2}{b2}} \le -2.289325936129236 \cdot 10^{-277}:\\ \;\;\;\;\frac{a1}{\frac{b1}{\frac{a2}{b2}}}\\ \mathbf{if}\;\frac{b1}{\frac{a2}{b2}} \le 9.67115627877642 \cdot 10^{-306}:\\ \;\;\;\;\frac{\frac{a1}{b1 \cdot b2}}{\frac{1}{a2}}\\ \mathbf{if}\;\frac{b1}{\frac{a2}{b2}} \le 2.1083299968523078 \cdot 10^{+293}:\\ \;\;\;\;\frac{a1}{\frac{b1}{\frac{a2}{b2}}}\\ \mathbf{else}:\\ \;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Target

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

Derivation

  1. Split input into 3 regimes
  2. if (/ b1 (/ a2 b2)) < -2.45747023661579e+162 or -2.289325936129236e-277 < (/ b1 (/ a2 b2)) < 9.67115627877642e-306

    1. Initial program 9.3

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

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

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

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

    if -2.45747023661579e+162 < (/ b1 (/ a2 b2)) < -2.289325936129236e-277 or 9.67115627877642e-306 < (/ b1 (/ a2 b2)) < 2.1083299968523078e+293

    1. Initial program 12.5

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

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

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

    if 2.1083299968523078e+293 < (/ b1 (/ a2 b2))

    1. Initial program 5.2

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

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

Runtime

Time bar (total: 33.7s)Debug logProfile

herbie shell --seed '#(1071215679 2002590028 935158157 1944352234 2656991306 2955288481)' +o rules:numerics
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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