Average Error: 11.2 → 5.7
Time: 7.5s
Precision: 64
Internal Precision: 128
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;a1 \cdot a2 \le -1.9665995000305292 \cdot 10^{+145}:\\ \;\;\;\;\frac{a2}{\frac{b1}{\frac{a1}{b2}}}\\ \mathbf{elif}\;a1 \cdot a2 \le -1.220921194640745 \cdot 10^{-304}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;a1 \cdot a2 \le 3.444221828659181 \cdot 10^{-157}:\\ \;\;\;\;a1 \cdot \left(\frac{a2}{b1} \cdot \frac{1}{b2}\right)\\ \mathbf{elif}\;a1 \cdot a2 \le 2.6204909279451456 \cdot 10^{+148}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a2}{\frac{b1}{\frac{a1}{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
Target11.3
Herbie5.7
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 3 regimes
  2. if (* a1 a2) < -1.9665995000305292e+145 or 2.6204909279451456e+148 < (* a1 a2)

    1. Initial program 25.5

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

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

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

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

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

    if -1.9665995000305292e+145 < (* a1 a2) < -1.220921194640745e-304 or 3.444221828659181e-157 < (* a1 a2) < 2.6204909279451456e+148

    1. Initial program 4.3

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

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

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

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

    if -1.220921194640745e-304 < (* a1 a2) < 3.444221828659181e-157

    1. Initial program 15.8

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a1 \cdot a2 \le -1.9665995000305292 \cdot 10^{+145}:\\ \;\;\;\;\frac{a2}{\frac{b1}{\frac{a1}{b2}}}\\ \mathbf{elif}\;a1 \cdot a2 \le -1.220921194640745 \cdot 10^{-304}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{elif}\;a1 \cdot a2 \le 3.444221828659181 \cdot 10^{-157}:\\ \;\;\;\;a1 \cdot \left(\frac{a2}{b1} \cdot \frac{1}{b2}\right)\\ \mathbf{elif}\;a1 \cdot a2 \le 2.6204909279451456 \cdot 10^{+148}:\\ \;\;\;\;\frac{a1 \cdot a2}{b1 \cdot b2}\\ \mathbf{else}:\\ \;\;\;\;\frac{a2}{\frac{b1}{\frac{a1}{b2}}}\\ \end{array}\]

Runtime

Time bar (total: 7.5s)Debug logProfile

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

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

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