Average Error: 11.0 → 6.3
Time: 10.5s
Precision: 64
Internal Precision: 576
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;a1 \cdot a2 \le -2.4100190819319214 \cdot 10^{+122}:\\ \;\;\;\;a1 \cdot \left(\frac{a2}{b1} \cdot \frac{1}{b2}\right)\\ \mathbf{elif}\;a1 \cdot a2 \le -1.4390835684418586 \cdot 10^{-161}:\\ \;\;\;\;\frac{a1 \cdot a2}{b2 \cdot b1}\\ \mathbf{elif}\;a1 \cdot a2 \le 0.0:\\ \;\;\;\;a1 \cdot \left(\frac{a2}{b1} \cdot \frac{1}{b2}\right)\\ \mathbf{elif}\;a1 \cdot a2 \le 3.180610833167153 \cdot 10^{+101}:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{b1} \cdot \left(a2 \cdot \frac{a1}{b2}\right)\\ \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
Target10.9
Herbie6.3
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 4 regimes
  2. if (* a1 a2) < -2.4100190819319214e+122 or -1.4390835684418586e-161 < (* a1 a2) < 0.0

    1. Initial program 18.2

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Initial simplification6.8

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

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

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

    if -2.4100190819319214e+122 < (* a1 a2) < -1.4390835684418586e-161

    1. Initial program 3.7

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Initial simplification15.1

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

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

      \[\leadsto \color{blue}{a1 \cdot \left(\frac{1}{b2} \cdot \frac{a2}{b1}\right)}\]
    6. Taylor expanded around inf 3.7

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

    if 0.0 < (* a1 a2) < 3.180610833167153e+101

    1. Initial program 4.5

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Initial simplification13.3

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

      \[\leadsto \color{blue}{\frac{a1 \cdot \frac{a2}{b1}}{b2}}\]
    5. Taylor expanded around 0 4.5

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

    if 3.180610833167153e+101 < (* a1 a2)

    1. Initial program 20.6

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Initial simplification13.1

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

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

      \[\leadsto \color{blue}{\left(\frac{a1}{b2} \cdot a2\right) \cdot \frac{1}{b1}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification6.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;a1 \cdot a2 \le -2.4100190819319214 \cdot 10^{+122}:\\ \;\;\;\;a1 \cdot \left(\frac{a2}{b1} \cdot \frac{1}{b2}\right)\\ \mathbf{elif}\;a1 \cdot a2 \le -1.4390835684418586 \cdot 10^{-161}:\\ \;\;\;\;\frac{a1 \cdot a2}{b2 \cdot b1}\\ \mathbf{elif}\;a1 \cdot a2 \le 0.0:\\ \;\;\;\;a1 \cdot \left(\frac{a2}{b1} \cdot \frac{1}{b2}\right)\\ \mathbf{elif}\;a1 \cdot a2 \le 3.180610833167153 \cdot 10^{+101}:\\ \;\;\;\;\frac{\frac{a1 \cdot a2}{b1}}{b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{b1} \cdot \left(a2 \cdot \frac{a1}{b2}\right)\\ \end{array}\]

Runtime

Time bar (total: 10.5s)Debug logProfile

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

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

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