Andrej Mitrovic: > enum width = 100; > double step = 1 / width; > ... > This seems like a very easy mistake to make.
Right, it was present even in Python 2.x: http://ideone.com/BEZqq The bug you have found is common enough to deserve a so fundamental change in Python, they have improved it in Python3.x: http://ideone.com/QeZEk In Pascal/ObjectPascal you have both FP division (/) and integer division (div). In OCaML too, there is "/" and "/." to tell them apart. I believe such distinction reduces similar bugs a lot. Even if Python2 was (and is) a very widespread language, and they have fixed the division, I don't think we'll see this change in D. Introducing an integer division operator in D is a possibility, but I think this is not enough to avoid your bug. ------------------------------ Steven Schveighoffer: > 1. is a horrible legacy thing, and should be removed. I agree, just as .1 :-) Saving one char of souece code is not worth the troubles this causes now and then. Bye, bearophile