Average Error: 10.6 → 3.0
Time: 32.2s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1 \cdot a2}{b1} \le -1.551139534245733 \cdot 10^{+241}:\\ \;\;\;\;\frac{a2}{\frac{b2}{a1} \cdot b1}\\ \mathbf{if}\;\frac{a1 \cdot a2}{b1} \le -4.459984812668878 \cdot 10^{-144}:\\ \;\;\;\;\frac{1}{\frac{b2}{\frac{a1 \cdot a2}{b1}}}\\ \mathbf{if}\;\frac{a1 \cdot a2}{b1} \le 5.0394695875807 \cdot 10^{-322}:\\ \;\;\;\;\frac{a2}{\frac{b2}{a1} \cdot b1}\\ \mathbf{if}\;\frac{a1 \cdot a2}{b1} \le 1.0141203643459555 \cdot 10^{+306}:\\ \;\;\;\;\frac{1}{\frac{b2}{\frac{a1 \cdot a2}{b1}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{a2}{\frac{b2}{a1} \cdot 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

Original10.6
Target10.8
Herbie3.0
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 2 regimes
  2. if (/ (* a1 a2) b1) < -1.551139534245733e+241 or -4.459984812668878e-144 < (/ (* a1 a2) b1) < 5.0394695875807e-322 or 1.0141203643459555e+306 < (/ (* a1 a2) b1)

    1. Initial program 14.7

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

      \[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
    4. Using strategy rm
    5. Applied clear-num24.0

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

      \[\leadsto \frac{1}{\color{blue}{\frac{b1 \cdot b2}{a2 \cdot a1}}}\]
    7. Applied simplify9.4

      \[\leadsto \color{blue}{\frac{\frac{a2}{b1}}{\frac{b2}{a1}}}\]
    8. Using strategy rm
    9. Applied div-inv9.4

      \[\leadsto \frac{\color{blue}{a2 \cdot \frac{1}{b1}}}{\frac{b2}{a1}}\]
    10. Applied associate-/l*5.9

      \[\leadsto \color{blue}{\frac{a2}{\frac{\frac{b2}{a1}}{\frac{1}{b1}}}}\]
    11. Applied simplify5.9

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

    if -1.551139534245733e+241 < (/ (* a1 a2) b1) < -4.459984812668878e-144 or 5.0394695875807e-322 < (/ (* a1 a2) b1) < 1.0141203643459555e+306

    1. Initial program 7.5

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

      \[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
    4. Using strategy rm
    5. Applied clear-num0.9

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

Runtime

Time bar (total: 32.2s)Debug logProfile

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

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

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