next up previous contents index
Next: Restrictions Up: Arithmetic Expressions Previous: Data Type Conversions

Integer Division

 

Integer division always produces a result which is another integer value: any fractional part is truncated, i.e. rounded towards zero. This makes it especially important to provide a decimal point at the end of a real constant even if the fractional part is zero. For example:

The combination of the two preceding rules may have unexpected effects, for example:

whereas (-2)**3.0 is an invalid expression as the computer would try to evaluate the logarithm of -2.0, which does not exist. Similarly, the expression:

whereas



Mario Storti
Wed Nov 4 19:32:56 ART 1998