Average Error: 11.1 → 3.6
Time: 13.0s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{b1 \cdot b2}{a2} \le -7.425788847764119 \cdot 10^{+304}:\\ \;\;\;\;\frac{a2}{b1} \cdot \frac{a1}{b2}\\ \mathbf{elif}\;\frac{b1 \cdot b2}{a2} \le -9.715238065617437 \cdot 10^{-309}:\\ \;\;\;\;\frac{1}{\frac{b1 \cdot b2}{a2}} \cdot a1\\ \mathbf{elif}\;\frac{b1 \cdot b2}{a2} \le 3.259654195747313 \cdot 10^{-296}:\\ \;\;\;\;\frac{\frac{a2 \cdot a1}{b1}}{b2}\\ \mathbf{elif}\;\frac{b1 \cdot b2}{a2} \le 1.6631962846554361 \cdot 10^{+243}:\\ \;\;\;\;\frac{a1}{\frac{1}{\frac{a2}{b1 \cdot b2}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{a2}{b2} \cdot \frac{a1}{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.1
Target11.2
Herbie3.6
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 5 regimes
  2. if (/ (* b1 b2) a2) < -7.425788847764119e+304

    1. Initial program 13.0

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

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

    if -7.425788847764119e+304 < (/ (* b1 b2) a2) < -9.715238065617437e-309

    1. Initial program 7.6

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

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

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

    if -9.715238065617437e-309 < (/ (* b1 b2) a2) < 3.259654195747313e-296

    1. Initial program 33.1

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

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

    if 3.259654195747313e-296 < (/ (* b1 b2) a2) < 1.6631962846554361e+243

    1. Initial program 7.0

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

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

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

    if 1.6631962846554361e+243 < (/ (* b1 b2) a2)

    1. Initial program 12.0

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

      \[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
  3. Recombined 5 regimes into one program.
  4. Final simplification3.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{b1 \cdot b2}{a2} \le -7.425788847764119 \cdot 10^{+304}:\\ \;\;\;\;\frac{a2}{b1} \cdot \frac{a1}{b2}\\ \mathbf{elif}\;\frac{b1 \cdot b2}{a2} \le -9.715238065617437 \cdot 10^{-309}:\\ \;\;\;\;\frac{1}{\frac{b1 \cdot b2}{a2}} \cdot a1\\ \mathbf{elif}\;\frac{b1 \cdot b2}{a2} \le 3.259654195747313 \cdot 10^{-296}:\\ \;\;\;\;\frac{\frac{a2 \cdot a1}{b1}}{b2}\\ \mathbf{elif}\;\frac{b1 \cdot b2}{a2} \le 1.6631962846554361 \cdot 10^{+243}:\\ \;\;\;\;\frac{a1}{\frac{1}{\frac{a2}{b1 \cdot b2}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{a2}{b2} \cdot \frac{a1}{b1}\\ \end{array}\]

Runtime

Time bar (total: 13.0s)Debug logProfile

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

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

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