a FOR loop and floating variables

bearophile bearophileHUGS at lycos.com
Thu May 2 11:54:44 PDT 2013


Simen Kjaeraas:

> Both 5 and 9 in the second example are integers (int). When you 
> divide
> one int by another, the result is an int, and hence (5/9) is 0.

Yes, smarter languages (like Pascal..., but also Python, Ada, 
etc) have two different division operators to avoid such silly C 
semantics, that sometimes causes bugs.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list