[sage-support] Unintuitive behavior of round()

2012-05-14 Thread Zimmermann Paul
Hi Lorenzo, the strange behaviour of round() is explained in the documentation: sage: u.round? ... This method evaluates an expression in "RR" first and rounds the result. This may lead to misleading results. sage: RR(u).round() 207855083711803936 sage: RealField(100)(u).rou

Re: [sage-support] Unintuitive behavior of round()

2012-05-13 Thread Michael Orlitzky
On 05/13/2012 12:50 PM, Lorenzo wrote: > u = sqrt(43203735824841025516773866131535024) We actually have a doctest confirming that it's awful =) This would probably be an easy project. Definition: u.round(self) Source: def round(self): """ Round this expression to the nea

[sage-support] Unintuitive behavior of round()

2012-05-13 Thread Lorenzo
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(43203735