next up previous contents
Next: Integer Division Up: Mixing Objects of Different Previous: Mixed Numeric Type Expressions

 

Mixed Type Assignment

When the whole RHS expression of a mixed type assignment statement has been evaluated it has a type, this type must then be converted to fit in with the LHS. This conversion could be either a promotion or a relegation. For example,

For example, as real values are stored approximately,

    REAL a,b; INTEGER i
    a = 3.0; b = 4.0
    i = b - a
    j = -0.9
    a = j

As long as care is taken, simple assignment should be trouble free.


next up previous contents
Next: Integer Division Up: Mixing Objects of Different Previous: Mixed Numeric Type Expressions

Adam Marshall ©University of Liverpool, 1996
Fri Dec 6 15:03:35 GMT 1996
Not for commercial use.