Average Error: 11.2 → 2.6
Time: 34.7s
Precision: 64
Internal Precision: 384
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\frac{a2}{\frac{b2}{a1}}}{b1} = -\infty:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \mathbf{if}\;\frac{\frac{a2}{\frac{b2}{a1}}}{b1} \le -4.436271183102775 \cdot 10^{-297}:\\ \;\;\;\;\frac{\frac{a2}{\frac{b2}{a1}}}{b1}\\ \mathbf{if}\;\frac{\frac{a2}{\frac{b2}{a1}}}{b1} \le 1.249618188204007 \cdot 10^{-305}:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \mathbf{if}\;\frac{\frac{a2}{\frac{b2}{a1}}}{b1} \le 7.14063348460921 \cdot 10^{+239}:\\ \;\;\;\;\frac{\frac{a2}{\frac{b2}{a1}}}{b1}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1}{\frac{b1 \cdot b2}{a2}}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Target

Original11.2
Target11.3
Herbie2.6
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 2 regimes
  2. if (/ (/ a2 (/ b2 a1)) b1) < -inf.0 or -4.436271183102775e-297 < (/ (/ a2 (/ b2 a1)) b1) < 1.249618188204007e-305 or 7.14063348460921e+239 < (/ (/ a2 (/ b2 a1)) b1)

    1. Initial program 7.6

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

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

    if -inf.0 < (/ (/ a2 (/ b2 a1)) b1) < -4.436271183102775e-297 or 1.249618188204007e-305 < (/ (/ a2 (/ b2 a1)) b1) < 7.14063348460921e+239

    1. Initial program 14.3

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

      \[\leadsto \color{blue}{\frac{a1}{b1} \cdot \frac{a2}{b2}}\]
    4. Using strategy rm
    5. Applied div-inv14.7

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

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

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

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

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

Runtime

Time bar (total: 34.7s)Debug logProfile

herbie shell --seed '#(1070991898 1055468627 4280279443 640792587 928206309 3646738750)' 
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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