4.4.2.2 RealNumber_decimal Objects

class RealNumber_decimal
A real number with an arbitrary number of bits of precision. This is implemented using the builtin Python Decimal type.

Create a number using RealNumber_decimal(value,)

INPUT: value - a float, integer, or string

sage: R = real_number.RealNumber_decimal
sage: R(1.32)
1.32
sage: R('2/3')
0.6666666666666666666666666667
sage: x = R(1.234); y = R(-1.1)
sage: x < y
False
sage: x > y
True
sage: x + y
0.134
sage: x - y
2.334
sage: x * y
-1.3574
sage: x / y
-1.121818181818181818181818182
sage: x*100
123.400
sage: x**100
1353679866.791074518495392801
sage: 2*x
2.468
sage: x*2.0
2.4680
sage: x.order()
Infinity
sage: x.prec()
Infinity
sage: float(x)
1.234
sage: int(y)
-1
RealNumber_decimal( value)

See About this document... for information on suggesting changes.