Average Error: 10.7 → 2.9
Time: 8.5s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} = -\infty:\\ \;\;\;\;\frac{\left(\frac{1}{b2} \cdot a2\right) \cdot a1}{b1}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -8.349989479786357 \cdot 10^{-276}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -0.0:\\ \;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 5.22467364138413 \cdot 10^{+269}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1}{\frac{b1}{\frac{1}{b2} \cdot a2}}\\ \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.7
Target10.5
Herbie2.9
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 4 regimes
  2. if (/ (* a1 a2) (* b1 b2)) < -inf.0

    1. Initial program 59.9

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

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

      \[\leadsto \color{blue}{\frac{\frac{a1}{b2} \cdot a2}{b1}}\]
    5. Using strategy rm
    6. Applied div-inv16.3

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

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

    if -inf.0 < (/ (* a1 a2) (* b1 b2)) < -8.349989479786357e-276 or -0.0 < (/ (* a1 a2) (* b1 b2)) < 5.22467364138413e+269

    1. Initial program 0.8

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

    if -8.349989479786357e-276 < (/ (* a1 a2) (* b1 b2)) < -0.0

    1. Initial program 11.9

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

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

    if 5.22467364138413e+269 < (/ (* a1 a2) (* b1 b2))

    1. Initial program 52.6

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

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

      \[\leadsto \color{blue}{\frac{\frac{a1}{b2} \cdot a2}{b1}}\]
    5. Using strategy rm
    6. Applied div-inv14.6

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

      \[\leadsto \frac{\color{blue}{a1 \cdot \left(\frac{1}{b2} \cdot a2\right)}}{b1}\]
    8. Using strategy rm
    9. Applied associate-/l*12.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} = -\infty:\\ \;\;\;\;\frac{\left(\frac{1}{b2} \cdot a2\right) \cdot a1}{b1}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -8.349989479786357 \cdot 10^{-276}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -0.0:\\ \;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 5.22467364138413 \cdot 10^{+269}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1}{\frac{b1}{\frac{1}{b2} \cdot a2}}\\ \end{array}\]

Runtime

Time bar (total: 8.5s)Debug logProfile

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

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

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