Lorenzo
unread,May 13, 2012, 12:50:11 PM5/13/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sage-s...@googlegroups.com
Hi everyone, first time sage user here.
I am puzzled by the behavior of round():
sage: t=sqrt(4320373582484102551677386613153502)
sage: floor(t)
65729548777426599
sage: round(t) #everything as expected, floor ≤ round ≤ ceil
65729548777426600
sage: ceil(t)
65729548777426600
sage: u = sqrt(43203735824841025516773866131535024) #add one digit
sage: floor(u)
207855083711803944
sage: round(u) # ?? smaller than floor(u)! No warning message...
207855083711803936
sage: r = round(u)
sage: ceil(u)
207855083711803945
sage: type(r) # seems to have still the same precision...? (i.e., it wasn’t converted to some "float type" – I admit of course that I don't know how the sage type system works)
<type 'sage.rings.integer.Integer'>
sage: version()
'Sage Version 4.8, Release Date: 2012-01-20'
uname -a
Darwin iMac.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386
Can someone explain this behavior? If this isn’t a bug, it is a very unintuitive "feature" for sage-neophytes, to say the least.
Thank you very much!