79 of 318
ZBasic System Library 69 ZX Microcontroller Family CULng Type Function returning UnsignedLong Invocation CULng(arg) Parameter Method Type Description arg ByVal numeric, Boolean, String or Enum The value to convert to UnsignedLong. Discussion This function converts any numeric or enumeration value to an UnsignedLong value. See the table below for details of the conversion. Input Type Result Byte, Boolean High 3 bytes zero, low byte as supplied. Integer High word will be zero, low word as supplied. UnsignedInteger High word will be zero, low word as supplied. Enum High word zero, low word contains Enum member value. Long Value bits are the same as supplied, although interpreted as an unsigned value. UnsignedLong No effect, the value is as supplied. Single Supplied value converted to signed 32-bit integer, rounded to the nearest integer. If the fractional part is exactly 0.5, the resulting integer will be even. This is known as “statistical rounding”. If the supplied value is negative or if it is too large to be represented in 32 bits, the result is undefined. String The result is the numeric value of the characters in the string, ignoring leading space and tab characters. The value string may begin with a plus or minus sign and an optional radix indicator (&H for hexadecimal, &O for octal, &B or &X for binary, all case insensitive). The conversion is terminated upon reaching the end of the string or encountering the first character that is not valid for the indicated radix. Example Dim ul as UnsignedLong ul = CULng(2.5) ' result is 2 ul = CULng(1.5) ' result is 2