Average Error: 10.7 → 2.9
Time: 8.3s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} = -\infty:\\ \;\;\;\;\frac{\frac{a1}{b2}}{\frac{b1}{a2}}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -5.181953352930447 \cdot 10^{-302}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 5.449514474752433 \cdot 10^{-302}:\\ \;\;\;\;\left(a2 \cdot \frac{a1}{b2}\right) \cdot \frac{1}{b1}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 8.81624581596053 \cdot 10^{+228}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a1}{b2}}{\frac{b1}{a2}}\\ \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.7
Target11.2
Herbie2.9
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 3 regimes
  2. if (/ (* a1 a2) (* b1 b2)) < -inf.0 or 8.81624581596053e+228 < (/ (* a1 a2) (* b1 b2))

    1. Initial program 48.4

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

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

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

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

    if -inf.0 < (/ (* a1 a2) (* b1 b2)) < -5.181953352930447e-302 or 5.449514474752433e-302 < (/ (* a1 a2) (* b1 b2)) < 8.81624581596053e+228

    1. Initial program 0.7

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

    if -5.181953352930447e-302 < (/ (* a1 a2) (* b1 b2)) < 5.449514474752433e-302

    1. Initial program 12.6

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} = -\infty:\\ \;\;\;\;\frac{\frac{a1}{b2}}{\frac{b1}{a2}}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -5.181953352930447 \cdot 10^{-302}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 5.449514474752433 \cdot 10^{-302}:\\ \;\;\;\;\left(a2 \cdot \frac{a1}{b2}\right) \cdot \frac{1}{b1}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 8.81624581596053 \cdot 10^{+228}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a1}{b2}}{\frac{b1}{a2}}\\ \end{array}\]

Runtime

Time bar (total: 8.3s)Debug logProfile

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

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

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