Tcl Source Code

View Ticket
Login
Ticket UUID: e7c21ed67892fa2c8f741b3350f8dbdbd83fa19c
Title: entier() fails to canonicalize result
Type: Bug Created on: 2016-12-16 20:31:47
Submitter: kbk Assigned to: dgp
Subsystem: 45. Parsing and Eval Severity: Important
Priority: 5 Medium Last modified: 2017-04-29 03:46:00
Status: Open Closed by: nobody
Resolution: None Closed on:
Version: 8.7
Description:
% set x 0x2
0x2
% expr entier($x)
2
% expr {entier($x) eq $x}
1

% set y [expr {entier($x)}]
2
% expr {$y eq $x}
0
% string equal [tcl::mathfunc::entier $x] $x
1

% tcl::mathfunc::entier $x
0x2
% tcl::mathfunc::wide $x
2
User Comments:
aspect added on 2017-04-29 03:46:00:
I'm not convinced that it should.  I think there's a case either way .. does it make a difference for quadcode?

See also:

% tcl::mathfunc::entier 0x2
0x2
% ::tcl::mathfunc::round 0x2
0x2
% ::tcl::mathfunc::abs 0x2
0x2
% ::tcl::mathfunc::abs 00.02
00.02
% ::tcl::mathfunc::max 0x2
0x2
% ::tcl::mathfunc::min 0x2
0x2

% ::tcl::mathfunc::int 0x2
2
% ::tcl::mathfunc::wide 0x2
2

arguably, wide() and int() are missing an optimisation here.

With -DACCEPT_NAN, most floating mathfuncs are also identity for non-canonical NaNs.