Q(uick)BASIC Function: CSNG
Quick View
CSNG
A conversion function that converts a numeric expression to a single-precision value
Worth knowing
Useful and cross-version information about the programming environments of QBasic and QuickBasic.
Syntax
- CSNG(numeric-expression)
Description/Parameter(s)
The CSNG function has the same effect as assigning numeric-expression to a single-precision variable.
CSNG rounds the value, if necessary, before converting it.
Example
The following example shows how CSNG rounds before converting the value:
A#=975.3421115#
B#=975.3421555#
PRINT A#; CSNG(A#); B#; CSNG(B#)
Sample Output:
975.3421115 975.3421 975.3421555 975.3422Syntax
- CSNG(numeric-expression)
Description/Parameter(s)
Usage Notes
- The CSNG function has the same effect as assigning numeric-expression to a single-precision variable.
- CSNG rounds the value, if necessary, before converting it.
Example
This example uses the CSNG funcion to round values before converting them to single precision.
A# = 975.3421115#
B# = 975.3421555#
PRINT A#; CSNG(A#); B#; CSNG(B#)
Sample Output:
975.3421115 975.3421 975.3421555 975.3422