Average Error: 11.1 → 2.1
Time: 36.0s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -1.7782620897866231 \cdot 10^{+308}:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -1.889169551734579 \cdot 10^{-299}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 8.260540744229808 \cdot 10^{-278}:\\ \;\;\;\;\log_* (1 + (e^{\frac{a1}{b2} \cdot \frac{a2}{b1}} - 1)^*)\\ \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 3.556060957443843 \cdot 10^{+304}:\\ \;\;\;\;\frac{a1 \cdot a2}{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

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original11.1
Target11.1
Herbie2.1
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 3 regimes
  2. if (/ (* a1 a2) (* b1 b2)) < -1.7782620897866231e+308 or 3.556060957443843e+304 < (/ (* a1 a2) (* b1 b2))

    1. Initial program 60.0

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

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

    if -1.7782620897866231e+308 < (/ (* a1 a2) (* b1 b2)) < -1.889169551734579e-299 or 8.260540744229808e-278 < (/ (* a1 a2) (* b1 b2)) < 3.556060957443843e+304

    1. Initial program 0.8

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

    if -1.889169551734579e-299 < (/ (* a1 a2) (* b1 b2)) < 8.260540744229808e-278

    1. Initial program 13.2

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

      \[\leadsto \color{blue}{\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}}\]
    4. Using strategy rm
    5. Applied log1p-expm1-u13.2

      \[\leadsto \color{blue}{\log_* (1 + (e^{\left(a1 \cdot a2\right) \cdot \frac{1}{b1 \cdot b2}} - 1)^*)}\]
    6. Applied simplify3.1

      \[\leadsto \log_* (1 + \color{blue}{(e^{\frac{a1}{b2} \cdot \frac{a2}{b1}} - 1)^*})\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 36.0s)Debug logProfile

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

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

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