Sören Lennart Berg on Mon, 13 Aug 2012 10:57:07 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

polroots stack overflow


Hi,
the input 
polroots(94.500000000000000000000000000000000000*z^12 - 5652.0000000000000000000000000000000000*z^11 + 144408.00000000000000000000000000000000*z^10 - 2045344.0000000000000000000000000000000*z^9 + 17354184.000000000000000000000000000000*z^8 - 87874688.000000000000000000000000000000*z^7 + 238393856.00000000000000000000000000000*z^6 - 191892480.00000000000000000000000000000*z^5 - 384723072.00000000000000000000000000000*z^4 - 589317120.00000000000000000000000000000*z^3 + 5892556800.0000000000000000000000000000*z^2 - 6157312000.0000000000000000000000000000*z - 3262720000.0000000000000000000000000000)

results in a stack overflow even when using almost a gigabyte for the stack. Is that a bug or just due to the polynomial having large degree and 'big' coefficients?

Interestingly the input
polroots(189/2*z^12 - 5652*z^11 + 144408*z^10 - 2045344*z^9 + 17354184*z^8 - 87874688*z^7 + 238393856*z^6 - 191892480*z^5 - 384723072*z^4 - 589317120*z^3 + 5892556800*z^2 - 6157312000*z - 3262720000)
works fine (it's mathematically the same polynomial with precise coefficients).

Is it a good idea to convert the coefficients of a polynomial to precise types(t_INT, t_FRAC) before computing roots? Will this make polroots work 'more stable'?

Best regards,
Sören