Average Error: 11.3 → 4.9
Time: 11.7s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;a1 \cdot a2 \le -3.881499779096344 \cdot 10^{+241}:\\ \;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\ \mathbf{elif}\;a1 \cdot a2 \le -3.6891869219375896 \cdot 10^{-239}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;a1 \cdot a2 \le 6.648346854945822 \cdot 10^{-243}:\\ \;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\ \mathbf{elif}\;a1 \cdot a2 \le 1.0906941155259606 \cdot 10^{+230}:\\ \;\;\;\;\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.3
Target11.1
Herbie4.9
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 2 regimes
  2. if (* a1 a2) < -3.881499779096344e+241 or -3.6891869219375896e-239 < (* a1 a2) < 6.648346854945822e-243 or 1.0906941155259606e+230 < (* a1 a2)

    1. Initial program 24.1

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

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

    if -3.881499779096344e+241 < (* a1 a2) < -3.6891869219375896e-239 or 6.648346854945822e-243 < (* a1 a2) < 1.0906941155259606e+230

    1. Initial program 4.9

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a1 \cdot a2 \le -3.881499779096344 \cdot 10^{+241}:\\ \;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\ \mathbf{elif}\;a1 \cdot a2 \le -3.6891869219375896 \cdot 10^{-239}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;a1 \cdot a2 \le 6.648346854945822 \cdot 10^{-243}:\\ \;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\ \mathbf{elif}\;a1 \cdot a2 \le 1.0906941155259606 \cdot 10^{+230}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\ \end{array}\]

Runtime

Time bar (total: 11.7s)Debug logProfile

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

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

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