Average Error: 10.8 → 5.7
Time: 17.8s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;a1 \cdot a2 \le -1.6055923935216512 \cdot 10^{+99}:\\ \;\;\;\;\frac{a1 \cdot \left(a2 \cdot \frac{1}{b2}\right)}{b1}\\ \mathbf{elif}\;a1 \cdot a2 \le -5.3056858791880856 \cdot 10^{-185}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;a1 \cdot a2 \le 7.568860959527629 \cdot 10^{-184}:\\ \;\;\;\;\left(\frac{1}{b2} \cdot a1\right) \cdot \frac{a2}{b1}\\ \mathbf{elif}\;a1 \cdot a2 \le 6.6258720858878675 \cdot 10^{+299}:\\ \;\;\;\;\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.8
Target11.2
Herbie5.7
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 3 regimes
  2. if (* a1 a2) < -1.6055923935216512e+99

    1. Initial program 20.5

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

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

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

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

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

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

    if -1.6055923935216512e+99 < (* a1 a2) < -5.3056858791880856e-185 or 7.568860959527629e-184 < (* a1 a2) < 6.6258720858878675e+299

    1. Initial program 4.2

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

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

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

      \[\leadsto \color{blue}{a1 \cdot \left(\frac{1}{b2} \cdot \frac{a2}{b1}\right)}\]
    6. Taylor expanded around inf 4.2

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

    if -5.3056858791880856e-185 < (* a1 a2) < 7.568860959527629e-184 or 6.6258720858878675e+299 < (* a1 a2)

    1. Initial program 18.0

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a1 \cdot a2 \le -1.6055923935216512 \cdot 10^{+99}:\\ \;\;\;\;\frac{a1 \cdot \left(a2 \cdot \frac{1}{b2}\right)}{b1}\\ \mathbf{elif}\;a1 \cdot a2 \le -5.3056858791880856 \cdot 10^{-185}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;a1 \cdot a2 \le 7.568860959527629 \cdot 10^{-184}:\\ \;\;\;\;\left(\frac{1}{b2} \cdot a1\right) \cdot \frac{a2}{b1}\\ \mathbf{elif}\;a1 \cdot a2 \le 6.6258720858878675 \cdot 10^{+299}:\\ \;\;\;\;\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: 17.8s)Debug logProfile

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

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

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