# Revision history [back]

### exact computations with algebraic numbers

I'm trying to do exact computations with algebraic numbers. In particular, I know to expect integer answers like 1, 0, and 3 at the end of my computations, but I'm getting something slightly off.

I noticed that if I run this a=AA(sqrt(2)); b=AA(1/sqrt(2)); c=a*b; print(c), Sage prints c as "1.000000000000000?".

Is this being handled in the computer as exactly 1? Otherwise, how can I do exact computations with algebraic numbers in Sage? I obtain the algebraic numbers I'm working with using algdep() and .roots(QQbar).

### exact computations with algebraic numbers

I'm trying to do exact computations with algebraic numbers. In particular, I know to expect integer answers like 1, 0, and 3 at the end of my computations, but I'm getting something slightly off.

I noticed that if I run this a=AA(sqrt(2)); b=AA(1/sqrt(2)); c=a*b; print(c), Sage prints c as "1.000000000000000?".

Is this being handled in the computer as exactly 1? Otherwise, how can I do exact computations with algebraic numbers in Sage? I obtain the algebraic numbers I'm working with using algdep() to find a polynomial and .roots(QQbar)..roots(QQbar) to find the roots of that polynomial.

 3 None slelievre 12586 ●11 ●122 ●250 http://carva.org/samue...

### exact computations with algebraic numbers

I'm trying to do exact computations with algebraic numbers. In particular, I know to expect integer answers like 1, 0, 1, 0, and 3 3 at the end of my computations, but I'm getting something slightly off.

I noticed that if I run this run

a=AA(sqrt(2));
b=AA(1/sqrt(2));
c=a*b;
print(c)sage: r = sqrt(2)
sage: a = AA(r)
sage: b = AA(1/r)
sage: c = a*b
, Sage prints c as "1.000000000000000?".

Then I get:

sage: c
1.000000000000000?


Is this being handled in the computer as exactly 1? 1? Otherwise, how can I do exact computations with algebraic numbers in Sage? I obtain the algebraic numbers I'm working with using algdep() algdep() to find a polynomial and .roots(QQbar) .roots(QQbar) to find the roots of that polynomial.