Average Error: 11.3 → 3.1
Time: 24.8s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a2}{b1} \cdot a1 \le -1.7643916642203566 \cdot 10^{+269}:\\ \;\;\;\;\frac{\frac{a1}{b2} \cdot a2}{b1}\\ \mathbf{elif}\;\frac{a2}{b1} \cdot a1 \le -1.0217538782175125 \cdot 10^{-230}:\\ \;\;\;\;\frac{\frac{a2}{b1} \cdot a1}{b2}\\ \mathbf{elif}\;\frac{a2}{b1} \cdot a1 \le 3.7054397350458017 \cdot 10^{-308}:\\ \;\;\;\;\frac{a1 \cdot \left(\frac{1}{b2} \cdot a2\right)}{b1}\\ \mathbf{elif}\;\frac{a2}{b1} \cdot a1 \le 6.479072608023693 \cdot 10^{+301}:\\ \;\;\;\;\frac{\frac{a2}{b1} \cdot a1}{b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1 \cdot a2}{b2 \cdot b1}\\ \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

Original11.3
Target11.2
Herbie3.1
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 4 regimes
  2. if (* a1 (/ a2 b1)) < -1.7643916642203566e+269

    1. Initial program 17.8

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Initial simplification31.4

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

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

    if -1.7643916642203566e+269 < (* a1 (/ a2 b1)) < -1.0217538782175125e-230 or 3.7054397350458017e-308 < (* a1 (/ a2 b1)) < 6.479072608023693e+301

    1. Initial program 12.7

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Initial simplification7.8

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

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

    if -1.0217538782175125e-230 < (* a1 (/ a2 b1)) < 3.7054397350458017e-308

    1. Initial program 6.8

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Initial simplification10.6

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

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

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

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

    if 6.479072608023693e+301 < (* a1 (/ a2 b1))

    1. Initial program 15.9

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification3.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{a2}{b1} \cdot a1 \le -1.7643916642203566 \cdot 10^{+269}:\\ \;\;\;\;\frac{\frac{a1}{b2} \cdot a2}{b1}\\ \mathbf{elif}\;\frac{a2}{b1} \cdot a1 \le -1.0217538782175125 \cdot 10^{-230}:\\ \;\;\;\;\frac{\frac{a2}{b1} \cdot a1}{b2}\\ \mathbf{elif}\;\frac{a2}{b1} \cdot a1 \le 3.7054397350458017 \cdot 10^{-308}:\\ \;\;\;\;\frac{a1 \cdot \left(\frac{1}{b2} \cdot a2\right)}{b1}\\ \mathbf{elif}\;\frac{a2}{b1} \cdot a1 \le 6.479072608023693 \cdot 10^{+301}:\\ \;\;\;\;\frac{\frac{a2}{b1} \cdot a1}{b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1 \cdot a2}{b2 \cdot b1}\\ \end{array}\]

Runtime

Time bar (total: 24.8s)Debug logProfile

herbie shell --seed 2018216 
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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