Average Error: 10.8 → 2.7
Time: 1.2m
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1}{b1} \cdot \frac{a2}{b2} \le -1.3968466779217588 \cdot 10^{+288}:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \mathbf{if}\;\frac{a1}{b1} \cdot \frac{a2}{b2} \le -4.265685843674341 \cdot 10^{-308}:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \mathbf{if}\;\frac{a1}{b1} \cdot \frac{a2}{b2} \le 1.5586659615523882 \cdot 10^{-284}:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\ \mathbf{if}\;\frac{a1}{b1} \cdot \frac{a2}{b2} \le 5.515640896192062 \cdot 10^{+297}:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot 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

Original10.8
Target10.9
Herbie2.7
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

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

    1. Initial program 12.3

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

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

    if -1.3968466779217588e+288 < (* (/ a1 b1) (/ a2 b2)) < -4.265685843674341e-308 or 1.5586659615523882e-284 < (* (/ a1 b1) (/ a2 b2)) < 5.515640896192062e+297

    1. Initial program 15.9

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

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

    if -4.265685843674341e-308 < (* (/ a1 b1) (/ a2 b2)) < 1.5586659615523882e-284

    1. Initial program 2.9

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

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

    if 5.515640896192062e+297 < (* (/ a1 b1) (/ a2 b2))

    1. Initial program 5.7

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

Runtime

Time bar (total: 1.2m)Debug logProfile

herbie shell --seed '#(1072967564 1937075727 894099792 790700740 1036514779 1027793188)' +o rules:numerics
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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