Average Error: 11.3 → 2.5
Time: 6.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{\frac{a1}{b2}}{\frac{b1}{a2}}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -4.877016002976535 \cdot 10^{-305}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 7.783309181859375 \cdot 10^{-256}:\\ \;\;\;\;\frac{\frac{a1}{b2}}{\frac{b1}{a2}}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 2.9378956593072405 \cdot 10^{+307}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a1}{b2}}{\frac{b1}{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

Original11.3
Target11.5
Herbie2.5
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 2 regimes
  2. if (/ (* a1 a2) (* b1 b2)) < -inf.0 or -4.877016002976535e-305 < (/ (* a1 a2) (* b1 b2)) < 7.783309181859375e-256 or 2.9378956593072405e+307 < (/ (* a1 a2) (* b1 b2))

    1. Initial program 24.2

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

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

      \[\leadsto \color{blue}{\frac{\frac{a1}{b2} \cdot a2}{b1}}\]
    5. Using strategy rm
    6. Applied associate-/l*4.6

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

    if -inf.0 < (/ (* a1 a2) (* b1 b2)) < -4.877016002976535e-305 or 7.783309181859375e-256 < (/ (* a1 a2) (* b1 b2)) < 2.9378956593072405e+307

    1. Initial program 0.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} = -\infty:\\ \;\;\;\;\frac{\frac{a1}{b2}}{\frac{b1}{a2}}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -4.877016002976535 \cdot 10^{-305}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 7.783309181859375 \cdot 10^{-256}:\\ \;\;\;\;\frac{\frac{a1}{b2}}{\frac{b1}{a2}}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 2.9378956593072405 \cdot 10^{+307}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a1}{b2}}{\frac{b1}{a2}}\\ \end{array}\]

Runtime

Time bar (total: 6.6s)Debug logProfile

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

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

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