I bet it has something to do with string output - try printf("%g",1.999999); to see what I mean.