Constant provides constant-like behavior for Float calculation context. It caches the constant value and re-computes for more precision by request.
example:
>>> pi = Constant(piGaussLegendre) >>> print pi 3.14159265358979 >>> pi + 1 4.14159265358979 >>> pi(RelativeError(0,1,2**100)) # for 100 bit precision 3.1415926535897932384626433832795
The first argument must be a function which computes the constant with an argument specifies error. The second argument can be used to set the default error.
Return the inverse of the number.
Return a rational number approximating the number.
(err) | Return the value at least as accurate as the given error err. |
Other operators are delegated to the cached value.