Average Error: 11.0 → 3.3
Time: 28.8s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -1.772316819689728 \cdot 10^{+308}:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -1.2840847114569742 \cdot 10^{-227}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 4.4169219608089 \cdot 10^{-310}:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 1.0223338474339116 \cdot 10^{+306}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a2}{b1}}{\frac{b2}{a1}}\\ \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.0
Target11.0
Herbie3.3
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 4 regimes
  2. if (/ (* a1 a2) (* b1 b2)) < -1.772316819689728e+308

    1. Initial program 59.9

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Using strategy rm
    3. Applied associate-/l*28.4

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

    if -1.772316819689728e+308 < (/ (* a1 a2) (* b1 b2)) < -1.2840847114569742e-227 or 4.4169219608089e-310 < (/ (* a1 a2) (* b1 b2)) < 1.0223338474339116e+306

    1. Initial program 0.9

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

    if -1.2840847114569742e-227 < (/ (* a1 a2) (* b1 b2)) < 4.4169219608089e-310

    1. Initial program 11.9

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Using strategy rm
    3. Applied times-frac4.0

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

    if 1.0223338474339116e+306 < (/ (* a1 a2) (* b1 b2))

    1. Initial program 60.7

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Using strategy rm
    3. Applied clear-num60.6

      \[\leadsto \color{blue}{\frac{1}{\frac{b1 \cdot b2}{a1 \cdot a2}}}\]
    4. Taylor expanded around 0 60.6

      \[\leadsto \frac{1}{\color{blue}{\frac{b1 \cdot b2}{a2 \cdot a1}}}\]
    5. Applied simplify5.3

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

Runtime

Time bar (total: 28.8s)Debug logProfile

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

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

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