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
Rounding behaviourNote that entier will truncate the decimal part of a number, effectively 'rounding towards 0':
% expr entier(-1.6) -1 % expr entier(1.6) 1Lars 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:
- To nearest integer
- This is round.
- To smallest integer >= given number
- This has to be coded as round(ceil($x)).
- To greatest integer <= given number
- This has to be coded as round(floor($x)).
- Round towards zero
- A.k.a. truncating decimals. This is entier. Specified by the hideous inequality 1 > abs($x) - abs(entier($x)) >= 0.