Average Error: 11.1 → 2.5
Time: 34.1s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\frac{a2}{b2}}{b1} \le -9.002484563678713 \cdot 10^{+295}:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\ \mathbf{if}\;\frac{\frac{a2}{b2}}{b1} \le -7.870597809431541 \cdot 10^{-264}:\\ \;\;\;\;a1 \cdot \frac{\frac{a2}{b2}}{b1}\\ \mathbf{if}\;\frac{\frac{a2}{b2}}{b1} \le 5.604703378829582 \cdot 10^{-261}:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\ \mathbf{if}\;\frac{\frac{a2}{b2}}{b1} \le 2.2120248113007157 \cdot 10^{+286}:\\ \;\;\;\;a1 \cdot \frac{\frac{a2}{b2}}{b1}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1}{b1 \cdot b2} \cdot 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

Original11.1
Target10.9
Herbie2.5
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 3 regimes
  2. if (/ (/ a2 b2) b1) < -9.002484563678713e+295 or -7.870597809431541e-264 < (/ (/ a2 b2) b1) < 5.604703378829582e-261

    1. Initial program 7.8

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

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

    if -9.002484563678713e+295 < (/ (/ a2 b2) b1) < -7.870597809431541e-264 or 5.604703378829582e-261 < (/ (/ a2 b2) b1) < 2.2120248113007157e+286

    1. Initial program 12.6

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

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

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

      \[\leadsto \frac{a1}{\color{blue}{\frac{1}{\frac{\frac{a2}{b2}}{b1}}}}\]
    8. Using strategy rm
    9. Applied div-inv0.5

      \[\leadsto \color{blue}{a1 \cdot \frac{1}{\frac{1}{\frac{\frac{a2}{b2}}{b1}}}}\]
    10. Applied simplify0.5

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

    if 2.2120248113007157e+286 < (/ (/ a2 b2) b1)

    1. Initial program 14.7

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

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

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

Runtime

Time bar (total: 34.1s)Debug logProfile

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

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

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