Skip to content

CSNG

Syntax

CSNG(X)

Versions: Extended, Disk

Description

Converts X to a single-precision floating-point number. Single-precision numbers have approximately 7 digits of precision and range from ±2.938736×10^-39 to ±1.701412×10^38.

If X is a double-precision number, CSNG rounds it to single precision. If X is an integer or string representation of a number, it is converted to single-precision format.

Example

10 A# = 123.456789012345#
20 B! = CSNG(A#)
30 PRINT A#, B!
RUN
123.456789012345  123.4568
Ok

Notes

  • Single-precision numbers use ! as a type suffix
  • Double-precision numbers use # as a type suffix
  • Conversion may result in loss of precision if converting from double precision

See Also

  • CDBL - Converts X to a double-precision floating-point number
  • CINT - Converts X to an integer by rounding the fractional portion
  • FIX - Returns the truncated integer part of X
  • INT - Return the largest integer less than or equal to a number (floor function)