Average Error: 11.2 → 6.3
Time: 8.5s
Precision: 64
Internal Precision: 128
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;b1 \cdot b2 \le -8.854408500492646 \cdot 10^{+66}:\\ \;\;\;\;\frac{a1}{\frac{b1}{\frac{1}{b2} \cdot a2}}\\ \mathbf{elif}\;b1 \cdot b2 \le -3.1306256861590317 \cdot 10^{-273}:\\ \;\;\;\;\frac{a2 \cdot a1}{b1 \cdot b2}\\ \mathbf{elif}\;b1 \cdot b2 \le 1.3472693522293 \cdot 10^{-145}:\\ \;\;\;\;\left(\frac{a1}{b2} \cdot a2\right) \cdot \frac{1}{b1}\\ \mathbf{elif}\;b1 \cdot b2 \le 1.3490855550365533 \cdot 10^{+135}:\\ \;\;\;\;\frac{a2 \cdot a1}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{a1}{b2} \cdot a2\right) \cdot \frac{1}{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

Original11.2
Target11.2
Herbie6.3
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 3 regimes
  2. if (* b1 b2) < -8.854408500492646e+66

    1. Initial program 12.1

      \[\frac{a1 \cdot a2}{b1 \cdot b2}\]
    2. Initial simplification7.6

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

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

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

      \[\leadsto \frac{\color{blue}{a1 \cdot \left(\frac{1}{b2} \cdot a2\right)}}{b1}\]
    8. Using strategy rm
    9. Applied associate-/l*8.3

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

    if -8.854408500492646e+66 < (* b1 b2) < -3.1306256861590317e-273 or 1.3472693522293e-145 < (* b1 b2) < 1.3490855550365533e+135

    1. Initial program 3.9

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

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

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

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

      \[\leadsto \frac{\color{blue}{a1 \cdot \left(\frac{1}{b2} \cdot a2\right)}}{b1}\]
    8. Using strategy rm
    9. Applied associate-*l/15.6

      \[\leadsto \frac{a1 \cdot \color{blue}{\frac{1 \cdot a2}{b2}}}{b1}\]
    10. Applied associate-*r/11.7

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

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

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

    if -3.1306256861590317e-273 < (* b1 b2) < 1.3472693522293e-145 or 1.3490855550365533e+135 < (* b1 b2)

    1. Initial program 20.6

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b1 \cdot b2 \le -8.854408500492646 \cdot 10^{+66}:\\ \;\;\;\;\frac{a1}{\frac{b1}{\frac{1}{b2} \cdot a2}}\\ \mathbf{elif}\;b1 \cdot b2 \le -3.1306256861590317 \cdot 10^{-273}:\\ \;\;\;\;\frac{a2 \cdot a1}{b1 \cdot b2}\\ \mathbf{elif}\;b1 \cdot b2 \le 1.3472693522293 \cdot 10^{-145}:\\ \;\;\;\;\left(\frac{a1}{b2} \cdot a2\right) \cdot \frac{1}{b1}\\ \mathbf{elif}\;b1 \cdot b2 \le 1.3490855550365533 \cdot 10^{+135}:\\ \;\;\;\;\frac{a2 \cdot a1}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{a1}{b2} \cdot a2\right) \cdot \frac{1}{b1}\\ \end{array}\]

Runtime

Time bar (total: 8.5s)Debug logProfile

herbie shell --seed 2018277 
(FPCore (a1 a2 b1 b2)
  :name "Quotient of products"

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

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