Average Error: 11.5 → 2.8
Time: 25.3s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1}{\frac{b1}{\frac{a2}{b2}}} \le -2.9030708056972143 \cdot 10^{+302}:\\ \;\;\;\;\frac{1}{\frac{b1 \cdot b2}{a1 \cdot a2}}\\ \mathbf{if}\;\frac{a1}{\frac{b1}{\frac{a2}{b2}}} \le -2.4927215504307683 \cdot 10^{-304}:\\ \;\;\;\;\frac{a1}{\frac{b1}{\frac{a2}{b2}}}\\ \mathbf{if}\;\frac{a1}{\frac{b1}{\frac{a2}{b2}}} \le 1.544055853131726 \cdot 10^{-299}:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\ \mathbf{if}\;\frac{a1}{\frac{b1}{\frac{a2}{b2}}} \le 9.873510957046396 \cdot 10^{+303}:\\ \;\;\;\;\frac{a1}{\frac{b1}{\frac{a2}{b2}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a1}{\frac{b1}{a2}}}{b2}\\ \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.5
Target10.8
Herbie2.8
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 4 regimes
  2. if (/ a1 (/ b1 (/ a2 b2))) < -2.9030708056972143e+302

    1. Initial program 15.8

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Using strategy rm
    3. Applied clear-num15.8

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

    if -2.9030708056972143e+302 < (/ a1 (/ b1 (/ a2 b2))) < -2.4927215504307683e-304 or 1.544055853131726e-299 < (/ a1 (/ b1 (/ a2 b2))) < 9.873510957046396e+303

    1. Initial program 14.8

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

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

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

    if -2.4927215504307683e-304 < (/ a1 (/ b1 (/ a2 b2))) < 1.544055853131726e-299

    1. Initial program 4.9

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

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

    if 9.873510957046396e+303 < (/ a1 (/ b1 (/ a2 b2)))

    1. Initial program 13.8

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

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

      \[\leadsto \frac{a1}{\color{blue}{\frac{b1}{\frac{a2}{b2}}}}\]
    6. Using strategy rm
    7. Applied associate-/r/35.7

      \[\leadsto \frac{a1}{\color{blue}{\frac{b1}{a2} \cdot b2}}\]
    8. Applied associate-/r*16.0

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

Runtime

Time bar (total: 25.3s)Debug logProfile

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

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

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