Single-precision floating-point (!)

Single-precision floating-point numbers (or more simply, Single-precision) may be the most versatile numeric type supported by PowerBASIC. Single-precision values can contain decimal points and have a range of +/- 8.43*10^-37 to 3.40*10^38. The type-specifier character for a Single-precision floating-point is: !.

Single-precision variables are identified by following the variable name with an exclamation point (i.e., var!) or by using the DEFSNG statement as described in the previous discussion of integrals. You can also declare Single-precision variables using the SINGLE keyword with the DIM statement. For example:

DIM I AS SINGLE

While Single-precision numbers can represent both enormous and microscopic values, they are limited to six digits of precision. In other words, Single-precision does a good job with figures like $451.21 and $6,411.92, but $671,421.22 cannot be represented exactly because it contains too many digits. Neither can 234.56789 or 0.00123456789. A Single-precision representation will come as close as it can in six digits: $671,421, or 234.568, or 0.00123457. Depending on your application, this rounding off can be a trivial or crippling deficiency. Like most modern compilers, PowerBASIC uses the IEEE standard for all floating-point arithmetic.

C/C++, Delphi, and Visual Basic all offer a single data type that is identical to the PowerBASIC Single-precision variable.

See Also

Currency (@) and Extended-currency (@@)

Double-precision floating-point (#)

Extended-precision floating-point (##)