Average Error: 10.5 → 10.7
Time: 35.0s
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;b2 \le -8.50757008846661 \cdot 10^{-77}:\\ \;\;\;\;{\left(\frac{a1}{b2} \cdot \frac{a2}{b1}\right)}^{1}\\ \mathbf{if}\;b2 \le 3.235465207188241 \cdot 10^{-304}:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\ \mathbf{if}\;b2 \le 2.00345658715073 \cdot 10^{-263}:\\ \;\;\;\;{\left(\frac{a1}{b2} \cdot \frac{a2}{b1}\right)}^{1}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Target

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

Derivation

  1. Split input into 3 regimes
  2. if b2 < -8.50757008846661e-77 or 3.235465207188241e-304 < b2 < 2.00345658715073e-263

    1. Initial program 10.0

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Using strategy rm
    3. Applied div-inv10.1

      \[\leadsto \color{blue}{\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}}\]
    4. Using strategy rm
    5. Applied pow110.1

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

      \[\leadsto \color{blue}{{\left(a1 \cdot a2\right)}^{1}} \cdot {\left(\frac{1}{b1 \cdot b2}\right)}^{1}\]
    7. Applied pow-prod-down10.1

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

      \[\leadsto {\color{blue}{\left(\frac{a1}{b2} \cdot \frac{a2}{b1}\right)}}^{1}\]

    if -8.50757008846661e-77 < b2 < 3.235465207188241e-304

    1. Initial program 13.2

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

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

    if 2.00345658715073e-263 < b2

    1. Initial program 10.0

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

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

Runtime

Time bar (total: 35.0s)Debug logProfile

herbie shell --seed '#(1063185673 2139736501 2393378123 1907444849 1070993796 1007244912)' 
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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