On Tue, Dec 9, 2008 at 4:25 PM, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > > On Dec 9, 2008, at 2:00 AM, Jason Grout wrote: > >> John Cremona wrote: >>> I would not expect this to work perfectly with floating point numbers >>> which are not representable exactly in binary. >> >> >> But we could add some sort of tolerance argument that would allow some >> sort of user-settable fuzz factor. Basically, the tolerance setting >> could be used when comparing with the ending value. > > Where would this be set? Whatever default it set, it would seem kind > of arbitrary. > > Perhaps this is a case where it could distinguish between RealLiteral > and RealNumber. >
This is not the answer. Look at this example: sage: srange(0,1.1,0.1,include_endpoint=True) [0.000000000000000, 0.100000000000000, 0.200000000000000, 0.300000000000000, 0.400000000000000, 0.500000000000000, 0.600000000000000, 0.700000000000000, 0.800000000000000, 0.900000000000000, 1.00000000000000, 1.10000000000000, 1.20000000000000] That's not right no matter what. The documentation says: " Return list of numbers a, a+step, ..., a+k*step, where a+k*step < b and a+(k+1)*step > b." where a,b are the first two inputs. Thus the implementation of srange is simply buggy because the person (me!) who implemented didn't take proper care of how floating point numbers behave. William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---