strange behavior with perl v 5.8.8

Dave Korn
Thu Sep 27 15:47:00 GMT 2007

On 27 September 2007 16:14, Andrew Louie wrote:

> Hello,
> I've run into a strange adding problem with perl:
> when incrementing by 0.1 

... an infinite, non-repeating fraction in binary floating-point, that can
only be inexactly approximated ... 

> i get a strange behavior where at some
> arbitrary  number, it will append 0.9999999999 to the end of the
> number.

  'fraid so.  Use rounding if you like.

  This is bog-standard floating point behaviour, part of the fundamental
limitations of the representation.  See, e.g.

or in general google for "floating point accuracy".

Can't think of a witty .sigline today....

Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list