Average Error: 11.2 → 7.1
Time: 7.5s
Precision: 64
Internal Precision: 128
\[\frac{a1 \cdot a2}{b1 \cdot b2}\]
\[\begin{array}{l} \mathbf{if}\;b1 \cdot b2 \le -2.134612255184803 \cdot 10^{-190} \lor \neg \left(b1 \cdot b2 \le 1.2047193301859343 \cdot 10^{-157}\right) \land b1 \cdot b2 \le 1.126230492164409 \cdot 10^{+231}:\\ \;\;\;\;\frac{a1}{\frac{b2}{\frac{1}{b1}}} \cdot a2\\ \mathbf{else}:\\ \;\;\;\;\frac{a2}{b1} \cdot \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
Target10.8
Herbie7.1
\[\frac{a1}{b1} \cdot \frac{a2}{b2}\]

Derivation

  1. Split input into 2 regimes
  2. if (* b1 b2) < -2.134612255184803e-190 or 1.2047193301859343e-157 < (* b1 b2) < 1.126230492164409e+231

    1. Initial program 6.5

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

      \[\leadsto \color{blue}{\frac{a1}{\frac{b1 \cdot b2}{a2}}}\]
    4. Using strategy rm
    5. Applied associate-/r/6.6

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

      \[\leadsto \color{blue}{\frac{\frac{a1}{b1}}{b2}} \cdot a2\]
    8. Using strategy rm
    9. Applied div-inv10.4

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

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

    if -2.134612255184803e-190 < (* b1 b2) < 1.2047193301859343e-157 or 1.126230492164409e+231 < (* b1 b2)

    1. Initial program 23.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b1 \cdot b2 \le -2.134612255184803 \cdot 10^{-190} \lor \neg \left(b1 \cdot b2 \le 1.2047193301859343 \cdot 10^{-157}\right) \land b1 \cdot b2 \le 1.126230492164409 \cdot 10^{+231}:\\ \;\;\;\;\frac{a1}{\frac{b2}{\frac{1}{b1}}} \cdot a2\\ \mathbf{else}:\\ \;\;\;\;\frac{a2}{b1} \cdot \frac{a1}{b2}\\ \end{array}\]

Runtime

Time bar (total: 7.5s)Debug logProfile

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

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

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