Average Error: 11.2 → 6.3
Time: 10.1s
Precision: 64
Internal Precision: 128
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;a1 \cdot a2 \le -7.510710233104737 \cdot 10^{+83}:\\ \;\;\;\;\frac{\frac{a2}{\frac{b2}{a1}}}{b1}\\ \mathbf{elif}\;a1 \cdot a2 \le -2.3382752892841924 \cdot 10^{-242}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1} \cdot \frac{1}{b2}\\ \mathbf{elif}\;a1 \cdot a2 \le 0.0:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \mathbf{elif}\;a1 \cdot a2 \le 2.5240948257229717 \cdot 10^{+90}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1} \cdot \frac{1}{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.2
Target10.9
Herbie6.3
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 3 regimes
  2. if (* a1 a2) < -7.510710233104737e+83

    1. Initial program 20.0

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

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

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

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

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

    if -7.510710233104737e+83 < (* a1 a2) < -2.3382752892841924e-242 or 0.0 < (* a1 a2) < 2.5240948257229717e+90

    1. Initial program 4.6

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

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

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

    if -2.3382752892841924e-242 < (* a1 a2) < 0.0 or 2.5240948257229717e+90 < (* a1 a2)

    1. Initial program 19.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a1 \cdot a2 \le -7.510710233104737 \cdot 10^{+83}:\\ \;\;\;\;\frac{\frac{a2}{\frac{b2}{a1}}}{b1}\\ \mathbf{elif}\;a1 \cdot a2 \le -2.3382752892841924 \cdot 10^{-242}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1} \cdot \frac{1}{b2}\\ \mathbf{elif}\;a1 \cdot a2 \le 0.0:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \mathbf{elif}\;a1 \cdot a2 \le 2.5240948257229717 \cdot 10^{+90}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1} \cdot \frac{1}{b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a1}{b1} \cdot \frac{a2}{b2}\\ \end{array}\]

Runtime

Time bar (total: 10.1s)Debug logProfile

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

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

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