Average Error: 11.1 → 2.1
Time: 7.6s
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{a1}{b2} \cdot \frac{a2}{b1}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -1.5446318367563974 \cdot 10^{-299}:\\ \;\;\;\;\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 6.997852254995738 \cdot 10^{+280}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1}{b2} \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

Original11.1
Target10.7
Herbie2.1
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 2 regimes
  2. if (/ (* a1 a2) (* b1 b2)) < -inf.0 or -1.5446318367563974e-299 < (/ (* a1 a2) (* b1 b2)) < 0.0 or 6.997852254995738e+280 < (/ (* a1 a2) (* b1 b2))

    1. Initial program 24.6

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

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

    if -inf.0 < (/ (* a1 a2) (* b1 b2)) < -1.5446318367563974e-299 or 0.0 < (/ (* a1 a2) (* b1 b2)) < 6.997852254995738e+280

    1. Initial program 0.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} = -\infty:\\ \;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -1.5446318367563974 \cdot 10^{-299}:\\ \;\;\;\;\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 6.997852254995738 \cdot 10^{+280}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\ \end{array}\]

Runtime

Time bar (total: 7.6s)Debug logProfile

herbie shell --seed 2018221 
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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