Average Error: 10.4 → 3.1
Time: 20.4s
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1}{b1} \cdot \frac{a2}{b2} = -\infty:\\ \;\;\;\;\frac{1}{\frac{b1 \cdot b2}{a1 \cdot a2}}\\ \mathbf{if}\;\frac{a1}{b1} \cdot \frac{a2}{b2} \le -4.2497434639426 \cdot 10^{-313}:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \mathbf{if}\;\frac{a1}{b1} \cdot \frac{a2}{b2} \le 3.162020133384 \cdot 10^{-322}:\\ \;\;\;\;\frac{1}{\frac{b1 \cdot b2}{a1 \cdot a2}}\\ \mathbf{if}\;\frac{a1}{b1} \cdot \frac{a2}{b2} \le 1.7288020775202732 \cdot 10^{+226}:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \mathbf{else}:\\ \;\;\;\;a1 \cdot \frac{\frac{a2}{b1}}{b2}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Target

Original10.4
Target10.9
Herbie3.1
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 3 regimes
  2. if (* (/ a1 b1) (/ a2 b2)) < -inf.0 or -4.2497434639426e-313 < (* (/ a1 b1) (/ a2 b2)) < 3.162020133384e-322

    1. Initial program 2.8

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

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

    if -inf.0 < (* (/ a1 b1) (/ a2 b2)) < -4.2497434639426e-313 or 3.162020133384e-322 < (* (/ a1 b1) (/ a2 b2)) < 1.7288020775202732e+226

    1. Initial program 15.2

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

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

    if 1.7288020775202732e+226 < (* (/ a1 b1) (/ a2 b2))

    1. Initial program 10.6

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

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

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

      \[\leadsto \color{blue}{a1 \cdot \left(\frac{1}{b1} \cdot \frac{a2}{b2}\right)}\]
    7. Applied simplify15.1

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

Runtime

Time bar (total: 20.4s)Debug logProfile

herbie shell --seed '#(1070609872 3456127585 2380521889 2328837196 1765472538 734540918)' 
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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