| 1 | initial version |
Thank you Volker! So let's give it a try:
def SciFormat(f, n) :
s = f.str()
t = ""
count = 0
w = true
for c in s :
if c <> 'e' and w :
if count < n+2 :
t += c
count += 1
else :
t += c
w = false
return t
b = 2.2379923576571269975e4767529 print b.parent() for i in (0..20): print SciFormat(b, i)
Real Field with 67 bits of precision 2.e4767529 2.2e4767529 2.23e4767529 2.237e4767529 2.2379e4767529 2.23799e4767529 2.237992e4767529 2.2379923e4767529 2.23799235e4767529 2.237992357e4767529 2.2379923576e4767529 2.23799235765e4767529 2.237992357657e4767529 2.2379923576571e4767529 2.23799235765712e4767529 2.237992357657126e4767529 2.2379923576571269e4767529 2.23799235765712699e4767529 2.237992357657126998e4767529 2.237992357657126998e4767529 2.237992357657126998e4767529
Please suggest improvements.
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.