Commodore 128 Programmer's Reference Manual page 24

Hide thumbs Also See for 128:
Table of Contents

Advertisement

14
COMMODORE 128
examples of floating-point constants in simple number notation and others in scientific
notation:
SIMPLE NUMBER
9.99
.0234
+ 10.01
-90.23
SCIENTIFIC
22.33E + 20
99999.234E-23
-45.89E-11
-3.14E + 17
NOTE: The values in either column are not equivalent.
u
ing values based upon floating-point numbers greater than nine digits. Your program
should test floating-point results and take them into consideration when basing these
values on future calculations.
I j
As mentioned, floatingpoint numbers are displayed as nine digits. If the value of a
Li
floating-point constant is less than .01 or greater than 999999999, the number is
displayed on the screen or printer in scientific notation. For example, the number
i
12345678901 is displayed as 1.23456789E +10. Otherwise, the simple number notation
J
is displayed. A floating-point constant in scientific notation appears in three parts:
1.
The mantissa is the leftmost number separated by a decimal point.
2. The letter E indicates that the number is displayed in exponential (scientific)
Li
notation.
3.
The exponent specifies the power of ten to which the number is raised and the
number of places the decimal point is moved in order to represent the number
_
in simple number notation.
The mantissa and exponent can be positive or negative. The exponent can be
within the range -39 to +38. If the exponent is negative, the decimal point moves to
the left representing it as a simple number. If the exponent is positive, the decimal
point moves to the right representing it in simple number notation.
| I
The Commodore 128 limits the size of floating-point numbers. The highest
U
number you can represent in scientific notation is 1.70141183E +38. If you try to
represent a number larger than that, an OVERFLOW ERROR occurs. The smallest
i j
number you can represent in scientific notation is 2.93873588E-39. If you try to
M
represent a number smaller than that, no error occurs but a zero is returned as the value.
You should therefore test floating-point values in your programs if your calculations are
based on very small numbers and the results depend on future calculations. Here are
examnles of floatine-noint constants in simnle number notation and others in sr.ientifir
>—'
U
u
u
STRING CONSTANTS
A string constant, as mentioned, is a sequential series of alphanumeric characters
(numbers, letters and symbols). A string constant can be as long as a 160-character input
*-*
u

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents