Average Error: 11.1 → 3.3
Time: 29.5s
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{b1 \cdot b2}{a2} = -\infty:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \mathbf{if}\;\frac{b1 \cdot b2}{a2} \le -6.245999175221679 \cdot 10^{-252}:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \mathbf{if}\;\frac{b1 \cdot b2}{a2} \le 0.0:\\ \;\;\;\;\left(a1 \cdot \frac{a2}{b1}\right) \cdot \frac{1}{b2}\\ \mathbf{if}\;\frac{b1 \cdot b2}{a2} \le 3.241622471439102 \cdot 10^{+267}:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \mathbf{else}:\\ \;\;\;\;\left(a1 \cdot \frac{a2}{b1}\right) \cdot \frac{1}{b2}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Target

Original11.1
Target11.3
Herbie3.3
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

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

    1. Initial program 13.7

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

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

    if -inf.0 < (/ (* b1 b2) a2) < -6.245999175221679e-252 or 0.0 < (/ (* b1 b2) a2) < 3.241622471439102e+267

    1. Initial program 7.1

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

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

    if -6.245999175221679e-252 < (/ (* b1 b2) a2) < 0.0 or 3.241622471439102e+267 < (/ (* b1 b2) a2)

    1. Initial program 19.6

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

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

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

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

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

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

Runtime

Time bar (total: 29.5s)Debug logProfile

herbie shell --seed '#(1070960995 739739648 2531964651 3069671617 351857262 3877178482)' +o rules:numerics
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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