Average Error: 11.1 → 11.1
Time: 1.1m
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;a2 \le -1.4885660885833155 \cdot 10^{+267}:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \mathbf{if}\;a2 \le -1.80664542272768 \cdot 10^{+86}:\\ \;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\ \mathbf{if}\;a2 \le 1.1813823376050212 \cdot 10^{-107}:\\ \;\;\;\;\frac{\frac{a1}{\frac{b1}{a2}}}{b2}\\ \mathbf{if}\;a2 \le 1.326772075669285 \cdot 10^{+158}:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \mathbf{if}\;a2 \le 4.58511155200543 \cdot 10^{+262}:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a2}{\frac{b2}{a1}}}{b1}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Target

Original11.1
Target10.8
Herbie11.1
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 5 regimes
  2. if a2 < -1.4885660885833155e+267 or 1.1813823376050212e-107 < a2 < 1.326772075669285e+158

    1. Initial program 10.1

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

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

    if -1.4885660885833155e+267 < a2 < -1.80664542272768e+86

    1. Initial program 14.0

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

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

    if -1.80664542272768e+86 < a2 < 1.1813823376050212e-107

    1. Initial program 9.6

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

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

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

    if 1.326772075669285e+158 < a2 < 4.58511155200543e+262

    1. Initial program 18.1

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

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

    if 4.58511155200543e+262 < a2

    1. Initial program 19.8

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

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

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

      \[\leadsto \frac{1}{\color{blue}{\frac{b2}{a1 \cdot a2} \cdot b1}}\]
    8. Applied associate-/r*23.1

      \[\leadsto \color{blue}{\frac{\frac{1}{\frac{b2}{a1 \cdot a2}}}{b1}}\]
    9. Applied simplify24.5

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

Runtime

Time bar (total: 1.1m)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit +o reduce:binary-search
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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