Average Error: 11.0 → 4.4
Time: 29.2s
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1 \cdot a2}{b1} = -\infty:\\ \;\;\;\;\frac{1}{\frac{\frac{b1 \cdot b2}{a2}}{a1}}\\ \mathbf{if}\;\frac{a1 \cdot a2}{b1} \le -3.630261236167883 \cdot 10^{-70}:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\ \mathbf{if}\;\frac{a1 \cdot a2}{b1} \le 1.6705992183737168 \cdot 10^{-295}:\\ \;\;\;\;\frac{a1}{\frac{1}{a2} \cdot \left(b1 \cdot b2\right)}\\ \mathbf{if}\;\frac{a1 \cdot a2}{b1} \le 1.4151540132496152 \cdot 10^{+256}:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a2}{b1} \cdot \frac{a1}{b2}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Target

Original11.0
Target11.3
Herbie4.4
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 4 regimes
  2. if (/ (* a1 a2) b1)

    1. Initial program 38.3

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

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

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

    if (/ (* a1 a2) b1) < -3.630261236167883e-70 or 1.6705992183737168e-295 < (/ (* a1 a2) b1) < 1.4151540132496152e+256

    1. Initial program 8.1

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

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

    if -3.630261236167883e-70 < (/ (* a1 a2) b1) < 1.6705992183737168e-295

    1. Initial program 9.1

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

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

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

    if 1.4151540132496152e+256 < (/ (* a1 a2) b1)

    1. Initial program 29.5

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{\frac{b1 \cdot b2}{a2}}{a1}}}\]
    6. Using strategy rm
    7. Applied div-inv15.2

      \[\leadsto \color{blue}{1 \cdot \frac{1}{\frac{\frac{b1 \cdot b2}{a2}}{a1}}}\]
    8. Applied simplify15.5

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;\frac{a1 \cdot a2}{b1} = -\infty:\\ \;\;\;\;\frac{1}{\frac{\frac{b1 \cdot b2}{a2}}{a1}}\\ \mathbf{if}\;\frac{a1 \cdot a2}{b1} \le -3.630261236167883 \cdot 10^{-70}:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\ \mathbf{if}\;\frac{a1 \cdot a2}{b1} \le 1.6705992183737168 \cdot 10^{-295}:\\ \;\;\;\;\frac{a1}{\frac{1}{a2} \cdot \left(b1 \cdot b2\right)}\\ \mathbf{if}\;\frac{a1 \cdot a2}{b1} \le 1.4151540132496152 \cdot 10^{+256}:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a2}{b1} \cdot \frac{a1}{b2}\\ \end{array}}\]

Runtime

Time bar (total: 29.2s)Debug log

herbie shell --seed '#(4187538376 1520029361 2786545844 1568991248 4244367449 2261141537)' 
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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