Average Error: 11.0 → 2.6
Time: 36.0s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2} = -\infty:\\ \;\;\;\;a1 \cdot \frac{\frac{a2}{b1}}{b2}\\ \mathbf{if}\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2} \le -9.6332906908877 \cdot 10^{-314}:\\ \;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\ \mathbf{if}\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2} \le 3.6275582312081 \cdot 10^{-316}:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \mathbf{if}\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2} \le 1.7474528032472565 \cdot 10^{+248}:\\ \;\;\;\;\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \end{array}\]

Error

Bits error versus a1

Bits error versus a2

Bits error versus b1

Bits error versus b2

Target

Original11.0
Target10.7
Herbie2.6
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 3 regimes
  2. if (* (* a1 a2) (/ 1 (* b1 b2))) < -inf.0

    1. Initial program 57.2

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

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

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

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

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

    if -inf.0 < (* (* a1 a2) (/ 1 (* b1 b2))) < -9.6332906908877e-314 or 3.6275582312081e-316 < (* (* a1 a2) (/ 1 (* b1 b2))) < 1.7474528032472565e+248

    1. Initial program 0.5

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

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

    if -9.6332906908877e-314 < (* (* a1 a2) (/ 1 (* b1 b2))) < 3.6275582312081e-316 or 1.7474528032472565e+248 < (* (* a1 a2) (/ 1 (* b1 b2)))

    1. Initial program 20.8

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

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

Runtime

Time bar (total: 36.0s)Debug logProfile

herbie shell --seed '#(1071852389 864846987 1238109217 3425890003 4124793586 650694553)' 
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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