On Thu, Dec 31, 2009 at 12:13 PM, eliot brenner <[email protected]> wrote:
> Is there a way to make all floating point calculations within a
> program or session occur to a fixed precision, say 500 digits? I know
> how to issue commands like
>
> R500 = RealField(500) #set up 500 bit precision arithmetic
> R500(pi)
>
> etc. for an individual calculation.
All commands, like sin, etc. will use the precision of their inputs.
sage: R500 = RealField(500)
sage: a = R500(pi)
sage: sin(a) + 3
3.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Note that if you're using a script, you'll want to make sure that
you're not using Python floats with have much lower precision. For
example,
sage: R500(1.3)
1.30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
sage: R500('1.3')
1.30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
sage: R500(float(1.3))
1.30000000000000004440892098500626161694526672363281250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
--Mike
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org