Next: , Previous: Using <code>poly_int</code> with C++ arithmetic operators, Up: Arithmetic on <code>poly_int</code>s


10.4.2 wi arithmetic on poly_ints

As well as the C++ operators, poly_int supports the following wi routines:

     wi::neg (p1, &overflow)
     
     wi::add (p1, p2)
     wi::add (p1, c2)
     wi::add (c1, p1)
     wi::add (p1, p2, sign, &overflow)
     
     wi::sub (p1, p2)
     wi::sub (p1, c2)
     wi::sub (c1, p1)
     wi::sub (p1, p2, sign, &overflow)
     
     wi::mul (p1, c2)
     wi::mul (c1, p1)
     wi::mul (p1, c2, sign, &overflow)
     
     wi::lshift (p1, c2)

These routines just check whether overflow occurs on any individual coefficient; it is not possible to know at compile time whether the final runtime value would overflow.