Average Error: 11.3 → 3.4
Time: 32.4s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;a1 \cdot \frac{\frac{a2}{b2}}{b1} \le -8.325614965798377 \cdot 10^{+306}:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\ \mathbf{if}\;a1 \cdot \frac{\frac{a2}{b2}}{b1} \le -3.771564587291262 \cdot 10^{-275}:\\ \;\;\;\;a1 \cdot \frac{\frac{a2}{b2}}{b1}\\ \mathbf{if}\;a1 \cdot \frac{\frac{a2}{b2}}{b1} \le 1.8670147877566 \cdot 10^{-318}:\\ \;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\ \mathbf{if}\;a1 \cdot \frac{\frac{a2}{b2}}{b1} \le 4.6678838316786364 \cdot 10^{+289}:\\ \;\;\;\;a1 \cdot \frac{\frac{a2}{b2}}{b1}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{a1}{b2} \cdot \frac{a2}{b1}} \cdot \sqrt{\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.4
Herbie3.4
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

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

    1. Initial program 15.7

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

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

    if -8.325614965798377e+306 < (* a1 (/ (/ a2 b2) b1)) < -3.771564587291262e-275 or 1.8670147877566e-318 < (* a1 (/ (/ a2 b2) b1)) < 4.6678838316786364e+289

    1. Initial program 14.5

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

      \[\leadsto \color{blue}{\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}}\]
    4. Using strategy rm
    5. Applied associate-*l*8.2

      \[\leadsto \color{blue}{a1 \cdot \left(a2 \cdot \frac{1}{b1 \cdot b2}\right)}\]
    6. Applied simplify0.9

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

    if -3.771564587291262e-275 < (* a1 (/ (/ a2 b2) b1)) < 1.8670147877566e-318

    1. Initial program 4.6

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

      \[\leadsto \color{blue}{\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}}\]

    if 4.6678838316786364e+289 < (* a1 (/ (/ a2 b2) b1))

    1. Initial program 14.4

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

      \[\leadsto \color{blue}{\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}}\]
    4. Using strategy rm
    5. Applied add-sqr-sqrt15.6

      \[\leadsto \color{blue}{\sqrt{\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}} \cdot \sqrt{\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}}}\]
    6. Applied simplify28.3

      \[\leadsto \color{blue}{\sqrt{\frac{a1}{b2} \cdot \frac{a2}{b1}}} \cdot \sqrt{\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}}\]
    7. Applied simplify16.7

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

Runtime

Time bar (total: 32.4s)Debug logProfile

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

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

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