expr function available since Tcl 8.5: Converts a number to some integral type (int, wide or bignum).
The name of this function is derived from French, via ALGOL.
LV So, this is functionally similar to a cast? What happens when the number being entiered doesn't fit into the size type? A bignum being cast into an int, for instance?
escargo 29 Nov 2006 - It's more like the round function. I think the point is that however big the number might be, it will pick the smallest integral type that will hold it. See TIP 237 [L1 ] for full details.
DKF: It's unspecified what size of value you get beyond "big enough", and a bignum is big enough to take any integer you want (assuming you've got the memory to hold it...)
Lars H: As a rounding function, this is unfortunately not particularly good. There a four common ways to round doubles to integers, three of which are useful:
and one which is not:
At least one [L2 ] specification of Algol was careful to not allow such behaviour for that entier.