74 of 323
ZBasic System Library 64 ZX Microcontroller Family CSng Type Function returning Single Invocation CSng(arg) Parameter Method Type Description arg ByVal numeric or Enum The value to convert to Single. Discussion This function converts any numeric or enumeration value to a Single value. For integral and Enum types, the result will be the floating point approximation of the integral value. If a Single type parameter is supplied, the result is identical to the parameter value. If a String type parameter is supplied, the result will be the numeric value of the character string. The form of the character representation supported is identical to that supported by ValueS(). Example Dim b as Byte Dim f as Single b = 21 f = CSng(b) Compatibility In BasicX, passing an UnsignedLong value larger than 2,147,483,647 erroneously generates a negative Single result. This implementation handles UnsignedLong values correctly.