 |
- Another way of storing fractions (non-integers), is with one byte per digit. This code
has a fixed decimal point, and a fixed number of digits.
- The format is FIXED(t,d) where t is the total number of digits, and d is the number of
decimal places. eg. FIXED(4,2) means 4 digits in all, and 2 of them after the decimal
point. eg. 23.87
- FIXED(4,2) can also be written as (99.99), the 9s indicating digits. When using this,
care must be taken to ensure that the sizes specified are large enough, otherwise
overflow, underflow, rounding and truncating errors can occur.
- ie. using (99.999)
- 0.001 / 9.99 = 00.000
UNDERFLOW
- 93.5 + 15.455 = 08.955 OVERFLOW
- 24.4565 = 24.457
ROUNDING (up)
- 24.4563 = 24.456
ROUNDING (down)
- 24.4565 = 24.456
TRUNCATING
|