Version 5 of int

Updated 2007-11-10 21:17:30 by dkf

[discuss tcl variable type of int - how much data fits in that amount, when does tcl use it, when does it benefit the user, etc.]

The expr-function int returns the 32-bit integer value of a number.

 % expr {int(- pow(2,31))}
 -2147483648
 % expr {int(pow(2,31)-1)}
 2147483647
 % expr {int(pow(2,31))}
 integer value too large to represent
 %

DGP No, it doesn't. It returns an integer within the range of the native C long type. (See tcl_platform(wordSize) for what that happens to be). The results of expr {int(.)} are not portable.