next up previous contents index
Next: Arithmetic Intrinsic Functions Up: Arithmetic Expressions Previous: Bit-wise Logical Operations on

Guidelines

Expressions with mixed data types should be examined carefully to ensure that the type-conversion rules have the desired effect. It does no harm to use the type conversion functions explicitly and it may make the working clearer.

Particular care is needed with the data types of literal constants. It is bad practice to use an integer constant where you really need a real constant. Although this will work in most expressions it is a serious mistake to use the wrong form of constant in the argument list of a procedure.

Long and complicated expressions which spread over several lines can be rather trying to read offer more scope for programming errors. Sometimes it is better to split the computation into several shorter equations at the expense of one or two temporary variables.

It is often tempting to try to write programs that are as efficient as possible. With modern compilers there is little point in trying to rearrange expressions to optimise speed. One of the few exceptions is that if an intrinsic function is provided it is always best to use it; thus SQRT(X) is likely to be faster and more accurate than X**0.5.

You may find that your system actually sets the whole of memory to zero initially, except for items defined with DATA statements, but it is very bad programming practice to rely on this.



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