Average Error: 10.7 → 2.5
Time: 34.9s
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{b1}{\frac{a2}{b2}} = -\infty:\\ \;\;\;\;\frac{\frac{a1}{b1 \cdot b2}}{\frac{1}{a2}}\\ \mathbf{if}\;\frac{b1}{\frac{a2}{b2}} \le -4.5468445794146326 \cdot 10^{-214}:\\ \;\;\;\;\frac{a1}{\frac{b1}{\frac{a2}{b2}}}\\ \mathbf{if}\;\frac{b1}{\frac{a2}{b2}} \le 1.3079441224287826 \cdot 10^{-284}:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\ \mathbf{if}\;\frac{b1}{\frac{a2}{b2}} \le 1.284665394776019 \cdot 10^{+261}:\\ \;\;\;\;\frac{a1}{\frac{b1}{\frac{a2}{b2}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Target

Original10.7
Target11.1
Herbie2.5
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 3 regimes
  2. if (/ b1 (/ a2 b2)) < -inf.0

    1. Initial program 4.8

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

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

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

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

    if -inf.0 < (/ b1 (/ a2 b2)) < -4.5468445794146326e-214 or 1.3079441224287826e-284 < (/ b1 (/ a2 b2)) < 1.284665394776019e+261

    1. Initial program 12.2

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

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

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

    if -4.5468445794146326e-214 < (/ b1 (/ a2 b2)) < 1.3079441224287826e-284 or 1.284665394776019e+261 < (/ b1 (/ a2 b2))

    1. Initial program 9.8

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

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

Runtime

Time bar (total: 34.9s)Debug logProfile

herbie shell --seed '#(1070386091 2509006183 1430610344 1025408621 36622005 1425925650)' +o rules:numerics
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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