Loading

TOLONG

conversion binary

Converts a value of primitive type or a BYTE ARRAY into a long value.

The TOLONG function consumes a parameter (BOOLEAN, LONG, DOUBLE, STRING) from the top of the stack and pushes back its conversion to long.

Beware of string inputs with leading zeros: it could be considered as octal. See examples below.

TOLONG is available since version 1.0.0.

See also

Signatures

Examples

'-42' TOLONG true TOLONG 1.95 TOLONG -1.95 TOLONG // beware of octal/hex representation in strings "010" TOLONG // return 8 "0x10" TOLONG // returns 16
//byte array '64' HEX-> TOLONG '9c' HEX-> TOLONG 123456789 TOHEX HEX-> TOLONG
//Limitations: Be aware of 64 bits limits 2 63 ** //max of a 64bit long '9223372036854775807' TOLONG //ok //'9223372036854775808' TOLONG //will fail with an error 92233720368547758000.24 //exceed the 64 bits double 92233720368547758000.24 TOLONG //ooops