Average Error: 10.7 → 2.7
Time: 24.7s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1 \cdot a2}{b1} = -\infty:\\ \;\;\;\;\frac{\frac{a1}{b1}}{b2} \cdot a2\\ \mathbf{if}\;\frac{a1 \cdot a2}{b1} \le -1.3541215647845363 \cdot 10^{-224}:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\ \mathbf{if}\;\frac{a1 \cdot a2}{b1} \le 1.4888223179164476 \cdot 10^{-282}:\\ \;\;\;\;\frac{a1}{\frac{b1}{\frac{a2}{b2}}}\\ \mathbf{if}\;\frac{a1 \cdot a2}{b1} \le 1.8648617247277241 \cdot 10^{+279}:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\ \mathbf{else}:\\ \;\;\;\;a1 \cdot \frac{a2}{b1 \cdot b2}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Target

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

Derivation

  1. Split input into 4 regimes
  2. if (/ (* a1 a2) b1) < -inf.0

    1. Initial program 37.5

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

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

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

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

    if -inf.0 < (/ (* a1 a2) b1) < -1.3541215647845363e-224 or 1.4888223179164476e-282 < (/ (* a1 a2) b1) < 1.8648617247277241e+279

    1. Initial program 7.2

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

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

    if -1.3541215647845363e-224 < (/ (* a1 a2) b1) < 1.4888223179164476e-282

    1. Initial program 9.8

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

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

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

    if 1.8648617247277241e+279 < (/ (* a1 a2) b1)

    1. Initial program 31.1

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

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

      \[\leadsto \color{blue}{a1 \cdot \frac{1}{\frac{b1 \cdot b2}{a2}}}\]
    6. Applied simplify12.3

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

Runtime

Time bar (total: 24.7s)Debug logProfile

herbie shell --seed '#(1072107073 2127697367 3936270018 2300570620 2134894798 4023771849)' 
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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