Average Error: 11.0 → 2.6
Time: 22.2s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{b1 \cdot b2}{a2} = -\infty:\\ \;\;\;\;\frac{a1 \cdot \frac{a2}{b2}}{b1}\\ \mathbf{if}\;\frac{b1 \cdot b2}{a2} \le -4.5506165736991245 \cdot 10^{-257}:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \mathbf{if}\;\frac{b1 \cdot b2}{a2} \le 6.448832594176252 \cdot 10^{-308}:\\ \;\;\;\;\frac{1}{\frac{b2}{\frac{a1}{b1} \cdot a2}}\\ \mathbf{if}\;\frac{b1 \cdot b2}{a2} \le 2.684224932606484 \cdot 10^{+283}:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1 \cdot \frac{a2}{b2}}{b1}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Try it out

  1. Inputs

  2. Original Output:

    Herbie Output:

Target

Original11.0
Target11.0
Herbie2.6
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 3 regimes
  2. if (/ (* b1 b2) a2) < -inf.0 or 2.684224932606484e+283 < (/ (* b1 b2) a2)

    1. Initial program 13.2

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

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

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

    if -inf.0 < (/ (* b1 b2) a2) < -4.5506165736991245e-257 or 6.448832594176252e-308 < (/ (* b1 b2) a2) < 2.684224932606484e+283

    1. Initial program 7.3

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

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

    if -4.5506165736991245e-257 < (/ (* b1 b2) a2) < 6.448832594176252e-308

    1. Initial program 30.5

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

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

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

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

Runtime

Time bar (total: 22.2s)Debug logProfile

herbie shell --seed '#(1072361757 3390613284 2339397988 1175251238 145061547 3101881848)' +o rules:numerics
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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