![]() |
|
How to force precision in SAGE? - Printable Version +- Tetration Forum (https://tetrationforum.org) +-- Forum: Tetration and Related Topics (https://tetrationforum.org/forumdisplay.php?fid=1) +--- Forum: Computation (https://tetrationforum.org/forumdisplay.php?fid=8) +--- Thread: How to force precision in SAGE? (/showthread.php?tid=28) |
How to force precision in SAGE? - jaydfox - 08/18/2007 I've been trying to remove some inaccuracy from my tetration library, and I keep getting precision limited to about 10-15 digits or so. I've finally figured out that despite using a RealField(256), which should provide at least a good 80 digits of precision, I'm getting truncations to double precision at some point. The net result is that I can perform a reversible series of transformations on 0 and get back numbers like -0.00000000718... Needless to say, it's very frustrating. I haven't found a global setting in SAGE for the precision of real arithmetic, so I'm stuck having to push all my reversible transformations (like e^z-1 and ln(z+1)) through a RealField variable. Even then, I'm still losing precision somewhere. What's the "right" way to use arbitrary precision math in SAGE? Please Help! RE: How to force precision in SAGE? - jaydfox - 08/18/2007 Never mind, I figured it out. Apperently, e^z and exp(z) are not equivalent. The former uses double precision, as if it were doing the following internally: \( e^z = \frac{e^z}{ln(b)} \), with b = 2.7182818284590458..., where that final 8 should be a 2. In other words, it treats e as any other base, and solves e^z by performing exp(z)/ln(e), where e is only accurate to double precision. Now I know not to use e^z. RE: How to force precision in SAGE? - jaydfox - 08/18/2007 Yep, I just verified, if I type e.base_ring(), I get: Real Field with 53 bits of precision Well, whatever, I'm using exp(z) now, so onwards and upwards. |