next up previous contents
Next: Intrinsic Procedures Up: Mixing Objects of Different Previous: Mixed Type Assignment

Integer Division

Confusion often arises about integer division; in short, division of two integers produces an integer result by truncation (towards zero). Consider,

    REAL a, b, c, d, e
    a = 1999/1000
    b = -1999/1000
    c = (1999+1)/1000
    d = 1999.0/1000
    e = 1999/1000.0

Great care must be taken when using mixed type arithmetic.

For more information, click here gif

Now try this question gif


next up previous contents
Next: Intrinsic Procedures Up: Mixing Objects of Different Previous: Mixed Type Assignment

Adam Marshall ©University of Liverpool, 1996
Fri Dec 6 18:56:08 GMT 1996
Not for commercial use.