These are chat archives for symengine/symengine

19th
Feb 2015
Aaron Meurer
@asmeurer
Feb 19 2015 20:20
don't you also have to guard against "overflow" when adding the numbers to multiply coefficients?
Ondřej Čertík
@certik
Feb 19 2015 21:58
@asmeurer yes, currently we just use GMP, so there is no overflow, but it is slower for smaller integers. So the optimization is to use machine integers, but you have to take care of overflowing yourself and switch to GMP automatically.
Aaron Meurer
@asmeurer
Feb 19 2015 23:37
I mean overflow across the bits
Ondřej Čertík
@certik
Feb 19 2015 23:49
Ah, using the exponents packing? Yes, you either do a guard bit, that way when you multiply two monomials, the worst that can happen is that the guard bit gets set to 1, in which case you raise an overflow error, or you check before multiplying two long polynomials that the final exponents fit into the packing. If they don't, you raise an exception and the user must then convert the data structure from the packed format into a tuple.
Aaron Meurer
@asmeurer
Feb 19 2015 23:49
ah I didn't think of using a guard bit. that would work
the guard bit would be faster, but would limit the size of the exponents more