expr function available since Tcl 8.5: 'tcl::matchfunc::entier
Converts a number to some integral type (int, wide or bignum). This function was introduced in TIP#237 .
The name of this function is derived from French, via ALGOL [L1 ].
This is different from tcl::mathfunc::int in that it won't overflow:
% expr int(256**$::tcl_platform(wordSize)) 0 % expr entier(256**$::tcl_platform(wordSize)) 18446744073709551616
Note that entier will truncate the decimal part of a number, effectively 'rounding towards 0':
% expr entier(-1.6) -1 % expr entier(1.6) 1
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 specification of Algol (now linked above) was careful to not allow such behaviour for that entier.