Average Error: 11.0 → 4.8
Time: 14.8s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;a1 \cdot a2 \le -8.817841110241764 \cdot 10^{+215}:\\ \;\;\;\;a1 \cdot \left(\frac{a2}{b1} \cdot \frac{1}{b2}\right)\\ \mathbf{elif}\;a1 \cdot a2 \le -4.312723039147459 \cdot 10^{-194}:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b2}}{b1}\\ \mathbf{elif}\;a1 \cdot a2 \le 2.6602715709559192 \cdot 10^{-197}:\\ \;\;\;\;\frac{a2}{b1} \cdot \frac{a1}{b2}\\ \mathbf{elif}\;a1 \cdot a2 \le 1.1737266761683139 \cdot 10^{+247}:\\ \;\;\;\;\frac{a1 \cdot a2}{b2 \cdot b1}\\ \mathbf{else}:\\ \;\;\;\;\frac{a2}{b1} \cdot \frac{a1}{b2}\\ \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
Target10.7
Herbie4.8
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 4 regimes
  2. if (* a1 a2) < -8.817841110241764e+215

    1. Initial program 35.9

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

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

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

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

    if -8.817841110241764e+215 < (* a1 a2) < -4.312723039147459e-194

    1. Initial program 4.4

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Initial simplification15.1

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

      \[\leadsto \color{blue}{\frac{\frac{a1}{b2} \cdot a2}{b1}}\]
    5. Taylor expanded around inf 4.4

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

    if -4.312723039147459e-194 < (* a1 a2) < 2.6602715709559192e-197 or 1.1737266761683139e+247 < (* a1 a2)

    1. Initial program 18.7

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Initial simplification5.1

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

    if 2.6602715709559192e-197 < (* a1 a2) < 1.1737266761683139e+247

    1. Initial program 4.2

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a1 \cdot a2 \le -8.817841110241764 \cdot 10^{+215}:\\ \;\;\;\;a1 \cdot \left(\frac{a2}{b1} \cdot \frac{1}{b2}\right)\\ \mathbf{elif}\;a1 \cdot a2 \le -4.312723039147459 \cdot 10^{-194}:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b2}}{b1}\\ \mathbf{elif}\;a1 \cdot a2 \le 2.6602715709559192 \cdot 10^{-197}:\\ \;\;\;\;\frac{a2}{b1} \cdot \frac{a1}{b2}\\ \mathbf{elif}\;a1 \cdot a2 \le 1.1737266761683139 \cdot 10^{+247}:\\ \;\;\;\;\frac{a1 \cdot a2}{b2 \cdot b1}\\ \mathbf{else}:\\ \;\;\;\;\frac{a2}{b1} \cdot \frac{a1}{b2}\\ \end{array}\]

Runtime

Time bar (total: 14.8s)Debug logProfile

herbie shell --seed 2018252 +o rules:numerics
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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