Silverfrost Logo About Us | Contact Us
 
REAL expressions

REAL expressions

The arithmetic expression x/3.0-0.9E6 is evaluated by taking a copy of the variable x, dividing by 3.0 and then a REAL constant value represented by 0.9E6 is subtracted. The resulting value is used in the PRINT statement. Expressions may be used as arguments in this way. It is not necessary to explicitly store the result before it is used.

The operators +, -, * (for multiply), / (for divide) and ** (for raising to a power) are used in REAL expressions to give the expected mathematical result (or rather the nearest approximation possible given the amount of memory used to store each variable). A REAL value can be raised to an INTEGER or a REAL power with the exception that a negative value can not be raised to a REAL power.

REAL constants contain a decimal point (represented by a full stop) or a letter E or both. 0.9E6 represents 0.9x106 and the letter E begins the exponent part of the constant which is an integer (possibly signed). Before the letter E is the mantissa that may be signed and is made up of digits and possibly a single decimal point. The mantissa is not optional and if the exponent part is absent, the mantissa must contain a decimal point.

 

 

Copyright © 1999-2017 Silverfrost Limited