Average Error: 10.8 → 2.2
Time: 8.2s
Precision: 64
Internal Precision: 128
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} = -\infty:\\ \;\;\;\;\frac{\left(\frac{1}{b2} \cdot a2\right) \cdot a1}{b1}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -1.671324024065761 \cdot 10^{-306}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 0.0:\\ \;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 2.5703034890500252 \cdot 10^{+300}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\ \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

Original10.8
Target11.0
Herbie2.2
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

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

    1. Initial program 60.0

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Initial simplification8.0

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

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

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

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

    if -inf.0 < (/ (* a1 a2) (* b1 b2)) < -1.671324024065761e-306 or 0.0 < (/ (* a1 a2) (* b1 b2)) < 2.5703034890500252e+300

    1. Initial program 0.8

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{a1 \cdot a2}{b2}}}{b1}\]
    7. Applied associate-/l/0.8

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

    if -1.671324024065761e-306 < (/ (* a1 a2) (* b1 b2)) < 0.0 or 2.5703034890500252e+300 < (/ (* a1 a2) (* b1 b2))

    1. Initial program 21.4

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Initial simplification3.0

      \[\leadsto \frac{a1}{b2} \cdot \frac{a2}{b1}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification2.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{a1 \cdot a2}{b1 \cdot b2} = -\infty:\\ \;\;\;\;\frac{\left(\frac{1}{b2} \cdot a2\right) \cdot a1}{b1}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le -1.671324024065761 \cdot 10^{-306}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 0.0:\\ \;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\ \mathbf{elif}\;\frac{a1 \cdot a2}{b1 \cdot b2} \le 2.5703034890500252 \cdot 10^{+300}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1}{b2} \cdot \frac{a2}{b1}\\ \end{array}\]

Runtime

Time bar (total: 8.2s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes11.02.20.011.080.4%
herbie shell --seed 2018354 
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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