Average Error: 11.0 → 5.5
Time: 8.3s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;b1 \cdot b2 \le -1.5046948957179673 \cdot 10^{+184}:\\ \;\;\;\;\frac{\frac{a1}{\frac{b1}{a2}}}{b2}\\ \mathbf{elif}\;b1 \cdot b2 \le -3.6876540917508607 \cdot 10^{-149}:\\ \;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\ \mathbf{elif}\;b1 \cdot b2 \le 1.2056560737827843 \cdot 10^{-276}:\\ \;\;\;\;\frac{\frac{a1}{\frac{b1}{a2}}}{b2}\\ \mathbf{elif}\;b1 \cdot b2 \le 8.296219974241661 \cdot 10^{+188}:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a2}{b2} \cdot a1}{b1}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original11.0
Target11.3
Herbie5.5
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 4 regimes
  2. if (* b1 b2) < -1.5046948957179673e+184 or -3.6876540917508607e-149 < (* b1 b2) < 1.2056560737827843e-276

    1. Initial program 22.6

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

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

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

    if -1.5046948957179673e+184 < (* b1 b2) < -3.6876540917508607e-149

    1. Initial program 4.0

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

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

    if 1.2056560737827843e-276 < (* b1 b2) < 8.296219974241661e+188

    1. Initial program 5.1

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

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

    if 8.296219974241661e+188 < (* b1 b2)

    1. Initial program 14.5

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b1 \cdot b2 \le -1.5046948957179673 \cdot 10^{+184}:\\ \;\;\;\;\frac{\frac{a1}{\frac{b1}{a2}}}{b2}\\ \mathbf{elif}\;b1 \cdot b2 \le -3.6876540917508607 \cdot 10^{-149}:\\ \;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\ \mathbf{elif}\;b1 \cdot b2 \le 1.2056560737827843 \cdot 10^{-276}:\\ \;\;\;\;\frac{\frac{a1}{\frac{b1}{a2}}}{b2}\\ \mathbf{elif}\;b1 \cdot b2 \le 8.296219974241661 \cdot 10^{+188}:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a2}{b2} \cdot a1}{b1}\\ \end{array}\]

Runtime

Time bar (total: 8.3s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes11.35.50.011.350.9%
herbie shell --seed 2018286 +o rules:numerics
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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