Package sage :: Package rings :: Module real_number :: Class RealNumber_decimal
[show private | hide private]
[frames | no frames]

Type RealNumber_decimal

object --+        
         |        
   Element --+    
             |    
    RealNumber --+
                 |
                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
EXAMPLES:
    >>> R = real_number.RealNumber_decimal
    >>> R(1.32)
    1.32
    >>> R('2/3')
    0.6666666666666666666666666667
    >>> x = R(1.234); y = R(-1.1)
    >>> x < y
    False
    >>> x > y
    True
    >>> x + y
    0.134
    >>> x - y
    2.334
    >>> x * y
    -1.3574
    >>> x / y
    -1.121818181818181818181818182
    >>> x*100
    123.400
    >>> x**100
    1353679866.791074518495392801
    >>> 2*x
    2.468
    >>> x*2.0
    2.4680
    >>> x.order()
    Infinity
    >>> x.prec()
    Infinity
    >>> float(x)
    1.234
    >>> int(y)
    -1

Method Summary
  __init__(self, value)
  prec(self)
    Inherited from RealNumber
  __abs__(self)
  __add__(self, right)
Return self + right.
  __cmp__(self, other)
Compare self and other.
  __div__(self, right)
Return the quotient self / right.
  __float__(self)
Return the coercion of self to a Python float.
  __int__(self)
Return the coercion of self to a Python int.
  __invert__(self)
Return the inverse of self.
  __long__(self)
Return the coercion of self to a Python long.
  __mul__(self, right)
Return the product of self and right.
  __neg__(self)
Return the negative of self.
  __pos__(self)
  __pow__(self, right)
  __radd__(self, left)
  __rdiv__(self, left)
  __repr__(self)
  __rmul__(self, left)
  __rsub__(self, left)
  __sub__(self, right)
  algebraic_dependence(self, n, flag)
Try to find a polynomial of degree at most n having this real number x as an approximate root.
  arg(self)
  imag(self)
  log(self)
Return the logarithm of self.
  order(self)
  real(self)
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Property Summary
    Inherited from RealNumber
  pari_object: PARI real associated to this real number

Generated by Epydoc 2.1 on Mon May 9 17:57:03 2005 http://epydoc.sf.net