A FLOAT is a positive or negative number with a decimal part
FLOAT literals: optional sign, digits, period, digits
123.456
1.23456E2
0.0001234
1.234e-4
Why use floats?
Example:
PUT ("The number of digits in a float value is: ");
PUT (FLOAT'DIGITS); NEW_LINE;
PUT ("The lowest float value is: ");
PUT (FLOAT'FIRST); NEW_LINE;
PUT ("The highest float value is: ");
PUT (FLOAT'LAST); NEW_LINE;
PUT ("The tiniest float value is: ");
PUT (FLOAT'SMALL); NEW_LINE;
The number of digits in a float value is: 15
The lowest float value is: -1.79769313486232E+308
The highest float value is: 1.79769313486232E+308
The tiniest float value is: 1.94469227433161E-62
Since floating point numbers are stored with only a fixed number of significant digits of accuracy, they are subject to rounding errors. Four types of errors arise from this:
I/O: special library provides GET, PUT
package float_io is new TEXT_IO.FLOAT_IO( FLOAT );
use float_io;
arithmetic
relational: