## Converting a float polynomial to integer polynomial

Messages in english

jocaps
Messages : 118
Inscription : lun. avr. 17, 2017 4:32 pm

### Converting a float polynomial to integer polynomial

Hi,

After some computations with algebraic numbers (as floats with high precision) I obtain a polynomial whose coefficients I know are integer but because the computations are done with floats, giac/xcas will show the coefficients with the decimals. I want to know what is the best way to convert this polynomial into an integral polynomial. As example:

I have the following polynomial:

Code : Tout sélectionner

``````0.30900000000000000000000000000000e3*x^6+0.11700000000000000000000000000000e4*x^5*y+0.47999999999999999999999999999999e2*x*y^2*z^3
``````
This is a polynomial with integer coefficients. So from that I want to get

Code : Tout sélectionner

``````309*x^6+1170*x^5*y+48*x*y^2*z^3
``````
any easy way of doing this in Xcas/giac?

Jose

lukamar
Messages : 296
Inscription : ven. juin 30, 2017 9:55 am
Localisation : Zagreb, Croatia

### Re: Converting a float polynomial to integer polynomial

Hello Jose,
I think the simplest way is to use the "exact" command:

Code : Tout sélectionner

``````p:=0.30900000000000000000000000000000e3*x^6+0.11700000000000000000000000000000e4*x^5*y+0.47999999999999999999999999999999e2*x*y^2*z^3;
exact(p)``````
The sensitivity depends on the epsilon constant which can be changed in session settings.

Luka

jocaps
Messages : 118
Inscription : lun. avr. 17, 2017 4:32 pm

### Re: Converting a float polynomial to integer polynomial

Hi Luka,

Wonderful, thanks a lot!

Apologies, I should have thought of that, I missed this command in the manual.

Jose