Average Error: 10.5 → 5.1
Time: 8.7s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;a1 \cdot a2 \le -1.5345042305071284 \cdot 10^{+217}:\\ \;\;\;\;\left(\frac{1}{b2} \cdot a1\right) \cdot \frac{a2}{b1}\\ \mathbf{elif}\;a1 \cdot a2 \le -1.7284269649744445 \cdot 10^{-177}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;a1 \cdot a2 \le 2.059505419090885 \cdot 10^{-298}:\\ \;\;\;\;\left(\frac{1}{b2} \cdot a1\right) \cdot \frac{a2}{b1}\\ \mathbf{elif}\;a1 \cdot a2 \le 3.6645559794884234 \cdot 10^{+167}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{b2} \cdot a1\right) \cdot \frac{a2}{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

Original10.5
Target10.3
Herbie5.1
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 2 regimes
  2. if (* a1 a2) < -1.5345042305071284e+217 or -1.7284269649744445e-177 < (* a1 a2) < 2.059505419090885e-298 or 3.6645559794884234e+167 < (* a1 a2)

    1. Initial program 21.2

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Initial simplification7.0

      \[\leadsto \frac{a1}{b2} \cdot \frac{a2}{b1}\]
    3. Using strategy rm
    4. Applied div-inv7.0

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

      \[\leadsto \color{blue}{a1 \cdot \left(\frac{1}{b2} \cdot \frac{a2}{b1}\right)}\]
    6. Using strategy rm
    7. Applied associate-*r*7.0

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

    if -1.5345042305071284e+217 < (* a1 a2) < -1.7284269649744445e-177 or 2.059505419090885e-298 < (* a1 a2) < 3.6645559794884234e+167

    1. Initial program 3.9

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Initial simplification13.8

      \[\leadsto \frac{a1}{b2} \cdot \frac{a2}{b1}\]
    3. Taylor expanded around 0 3.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a1 \cdot a2 \le -1.5345042305071284 \cdot 10^{+217}:\\ \;\;\;\;\left(\frac{1}{b2} \cdot a1\right) \cdot \frac{a2}{b1}\\ \mathbf{elif}\;a1 \cdot a2 \le -1.7284269649744445 \cdot 10^{-177}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;a1 \cdot a2 \le 2.059505419090885 \cdot 10^{-298}:\\ \;\;\;\;\left(\frac{1}{b2} \cdot a1\right) \cdot \frac{a2}{b1}\\ \mathbf{elif}\;a1 \cdot a2 \le 3.6645559794884234 \cdot 10^{+167}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{b2} \cdot a1\right) \cdot \frac{a2}{b1}\\ \end{array}\]

Runtime

Time bar (total: 8.7s)Debug logProfile

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

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

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