Average Error: 11.0 → 5.6
Time: 6.7s
Precision: 64
Internal Precision: 128
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;a1 \cdot a2 \le -1.1598356346117476 \cdot 10^{+168}:\\ \;\;\;\;\frac{\frac{a1}{\frac{b1}{a2}}}{b2}\\ \mathbf{elif}\;a1 \cdot a2 \le -5.904730415373209 \cdot 10^{-181}:\\ \;\;\;\;\frac{a1 \cdot a2}{b2 \cdot b1}\\ \mathbf{elif}\;a1 \cdot a2 \le 3.7488137802570405 \cdot 10^{-238}:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \mathbf{elif}\;a1 \cdot a2 \le 1.5550221396521212 \cdot 10^{+204}:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b2}}{b1}\\ \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.0
Target11.2
Herbie5.6
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 4 regimes
  2. if (* a1 a2) < -1.1598356346117476e+168

    1. Initial program 26.8

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

      \[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
    4. Using strategy rm
    5. Applied associate-/l*16.4

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

    if -1.1598356346117476e+168 < (* a1 a2) < -5.904730415373209e-181

    1. Initial program 4.2

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

      \[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
    4. Taylor expanded around inf 4.2

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

    if -5.904730415373209e-181 < (* a1 a2) < 3.7488137802570405e-238 or 1.5550221396521212e+204 < (* a1 a2)

    1. Initial program 18.8

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

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

    if 3.7488137802570405e-238 < (* a1 a2) < 1.5550221396521212e+204

    1. Initial program 4.3

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

      \[\leadsto \color{blue}{\frac{\frac{a1 \cdot a2}{b1}}{b2}}\]
    4. Taylor expanded around inf 4.3

      \[\leadsto \color{blue}{\frac{a1 \cdot a2}{b2 \cdot b1}}\]
    5. Using strategy rm
    6. Applied associate-/r*4.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a1 \cdot a2 \le -1.1598356346117476 \cdot 10^{+168}:\\ \;\;\;\;\frac{\frac{a1}{\frac{b1}{a2}}}{b2}\\ \mathbf{elif}\;a1 \cdot a2 \le -5.904730415373209 \cdot 10^{-181}:\\ \;\;\;\;\frac{a1 \cdot a2}{b2 \cdot b1}\\ \mathbf{elif}\;a1 \cdot a2 \le 3.7488137802570405 \cdot 10^{-238}:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \mathbf{elif}\;a1 \cdot a2 \le 1.5550221396521212 \cdot 10^{+204}:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b2}}{b1}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \end{array}\]

Runtime

Time bar (total: 6.7s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes11.05.60.011.048.9%
herbie shell --seed 2018351 +o rules:numerics
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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