Average Error: 10.9 → 3.6
Time: 48.9s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -3.299015055999917 \cdot 10^{+294}:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -2.495598836304291 \cdot 10^{-308}:\\ \;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\ \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 1.2197391025701286 \cdot 10^{-308}:\\ \;\;\;\;\frac{\frac{1}{\frac{b1}{a1 \cdot a2}}}{b2}\\ \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 2.1300160425759017 \cdot 10^{+281}:\\ \;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Split input into 3 regimes
  2. if (/ (* a1 a2) (* b1 b2)) < -3.299015055999917e+294 or 2.1300160425759017e+281 < (/ (* a1 a2) (* b1 b2))

    1. Initial program 53.8

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

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

    if -3.299015055999917e+294 < (/ (* a1 a2) (* b1 b2)) < -2.495598836304291e-308 or 1.2197391025701286e-308 < (/ (* a1 a2) (* b1 b2)) < 2.1300160425759017e+281

    1. Initial program 0.9

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

      \[\leadsto \color{blue}{\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}}\]

    if -2.495598836304291e-308 < (/ (* a1 a2) (* b1 b2)) < 1.2197391025701286e-308

    1. Initial program 13.9

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

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

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

Runtime

Time bar (total: 48.9s)Debug logProfile

herbie shell --seed 2019053 +o rules:numerics
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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