Average Error: 10.7 → 2.3
Time: 37.5s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1}{b1} \cdot \frac{a2}{b2} \le -4.907785105489659 \cdot 10^{+304}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{if}\;\frac{a1}{b1} \cdot \frac{a2}{b2} \le -4.9895697899645 \cdot 10^{-311}:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \mathbf{if}\;\frac{a1}{b1} \cdot \frac{a2}{b2} \le 3.8665477058955957 \cdot 10^{-299}:\\ \;\;\;\;\frac{\frac{a2}{b1}}{\frac{b2}{a1}}\\ \mathbf{if}\;\frac{a1}{b1} \cdot \frac{a2}{b2} \le 8.806627718173245 \cdot 10^{+279}:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \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
Target11.0
Herbie2.3
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 3 regimes
  2. if (* (/ a1 b1) (/ a2 b2)) < -4.907785105489659e+304 or 8.806627718173245e+279 < (* (/ a1 b1) (/ a2 b2))

    1. Initial program 8.7

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

    if -4.907785105489659e+304 < (* (/ a1 b1) (/ a2 b2)) < -4.9895697899645e-311 or 3.8665477058955957e-299 < (* (/ a1 b1) (/ a2 b2)) < 8.806627718173245e+279

    1. Initial program 15.8

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

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

    if -4.9895697899645e-311 < (* (/ a1 b1) (/ a2 b2)) < 3.8665477058955957e-299

    1. Initial program 2.6

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

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

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

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

Runtime

Time bar (total: 37.5s)Debug logProfile

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

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

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