On Sat, 17 Dec 2005 09:26:39 +0000, Bengt Richter wrote:
> I wonder if this won't work (for IEEE 754 double that is) > > from math import frexp > def nextf(x, y): > f,e = frexp(x) > if (f==0.5 or f==-0.5) and x>=y: eps = 2.0**-54 > else: eps = 2.0**-53 > if x<y: return (f+eps)*2.0**e > else: return (f-eps)*2.0**e Doesn't that assume floats are 64 bits? Is it possible that they might not be on some platform or another? -- Steven. -- http://mail.python.org/mailman/listinfo/python-list