Next: Other `poly_int`

arithmetic, Previous: `wi`

arithmetic on `poly_int`

s, Up: Arithmetic on `poly_int`

s [Contents][Index]

`poly_int`

sDivision of `poly_int`

s is possible for certain inputs. The functions
for division return true if the operation is possible and in most cases
return the results by pointer. The routines are:

- ‘
`multiple_p (`’`a`,`b`) - ‘
`multiple_p (`’`a`,`b`, &`quotient`) Return true if

`a`is an exact multiple of`b`, storing the result in`quotient`if so. There are overloads for various combinations of polynomial and constant`a`,`b`and`quotient`.- ‘
`constant_multiple_p (`’`a`,`b`) - ‘
`constant_multiple_p (`’`a`,`b`, &`quotient`) Like

`multiple_p`

, but also test whether the multiple is a compile-time constant.- ‘
`can_div_trunc_p (`’`a`,`b`, &`quotient`) - ‘
`can_div_trunc_p (`’`a`,`b`, &`quotient`, &`remainder`) Return true if we can calculate ‘

`trunc (`’ at compile time, storing the result in`a`/`b`)`quotient`and`remainder`if so.- ‘
`can_div_away_from_zero_p (`’`a`,`b`, &`quotient`) Return true if we can calculate ‘

’ at compile time, rounding away from zero. Store the result in`a`/`b``quotient`if so.Note that this is true if and only if

`can_div_trunc_p`

is true. The only difference is in the rounding of the result.

There is also an asserting form of division:

- ‘
`exact_div (`’`a`,`b`) Assert that

`a`is a multiple of`b`and return ‘’. The result is a`a`/`b``poly_int`

if`a`is a`poly_int`

.