"Fossies" - the Fresh Open Source Software Archive

Member "NZMATH-1.2.0/nzmath/plugin/math/default.py" (19 Nov 2012, 614 Bytes) of package /linux/misc/old/NZMATH-1.2.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "default.py" see the Fossies "Dox" file reference documentation.

    1 """
    2 default -- default Python types and modules
    3 """
    4 
    5 import math
    6 import cmath
    7 
    8 MATHMODULE = math
    9 CMATHMODULE = cmath
   10 FLOATTYPE = float
   11 COMPLEXTYPE = complex
   12 PRECISION_CHANGEABLE = False
   13 
   14 def CHECK_REAL_OR_COMPLEX(testee):
   15     """
   16     Return 1 if testee is a real number, 0 if complex.
   17     If testee is not a complex number, raise an exception.
   18     """
   19     try:
   20         comp = COMPLEXTYPE(testee)
   21         return 0 == comp.imag
   22     except TypeError:
   23         raise
   24 
   25 def SETPRECISION(prec):
   26     """
   27     Set precision.
   28 
   29     prec is the number of bits.
   30     """
   31     raise NotImplementedError("no precision setting")
   32