Average Error: 11.0 → 6.0
Time: 13.4s
Precision: 64
Internal Precision: 320
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;a1 \cdot a2 \le -2.6682502584446555 \cdot 10^{+266}:\\ \;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\ \mathbf{elif}\;a1 \cdot a2 \le -9.200589878073352 \cdot 10^{-190}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;a1 \cdot a2 \le 1.7978992371601642 \cdot 10^{-245}:\\ \;\;\;\;a1 \cdot \left(\frac{a2}{b2} \cdot \frac{1}{b1}\right)\\ \mathbf{elif}\;a1 \cdot a2 \le 1.2981720657923453 \cdot 10^{+18}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;a1 \cdot \left(\frac{a2}{b2} \cdot \frac{1}{b1}\right)\\ \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.0
Target10.7
Herbie6.0
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 3 regimes
  2. if (* a1 a2) < -2.6682502584446555e+266

    1. Initial program 45.7

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

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

    if -2.6682502584446555e+266 < (* a1 a2) < -9.200589878073352e-190 or 1.7978992371601642e-245 < (* a1 a2) < 1.2981720657923453e+18

    1. Initial program 4.3

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Initial simplification13.5

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

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

      \[\leadsto \color{blue}{a1 \cdot \left(\frac{1}{b2} \cdot \frac{a2}{b1}\right)}\]
    6. Taylor expanded around inf 4.3

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

    if -9.200589878073352e-190 < (* a1 a2) < 1.7978992371601642e-245 or 1.2981720657923453e+18 < (* a1 a2)

    1. Initial program 15.5

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Initial simplification8.1

      \[\leadsto \frac{a1}{b2} \cdot \frac{a2}{b1}\]
    3. Using strategy rm
    4. Applied div-inv8.1

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

      \[\leadsto \color{blue}{a1 \cdot \left(\frac{1}{b2} \cdot \frac{a2}{b1}\right)}\]
    6. Using strategy rm
    7. Applied div-inv8.0

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

      \[\leadsto a1 \cdot \color{blue}{\left(\left(\frac{1}{b2} \cdot a2\right) \cdot \frac{1}{b1}\right)}\]
    9. Taylor expanded around -inf 7.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a1 \cdot a2 \le -2.6682502584446555 \cdot 10^{+266}:\\ \;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\ \mathbf{elif}\;a1 \cdot a2 \le -9.200589878073352 \cdot 10^{-190}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;a1 \cdot a2 \le 1.7978992371601642 \cdot 10^{-245}:\\ \;\;\;\;a1 \cdot \left(\frac{a2}{b2} \cdot \frac{1}{b1}\right)\\ \mathbf{elif}\;a1 \cdot a2 \le 1.2981720657923453 \cdot 10^{+18}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;a1 \cdot \left(\frac{a2}{b2} \cdot \frac{1}{b1}\right)\\ \end{array}\]

Runtime

Time bar (total: 13.4s)Debug logProfile

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

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

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