Tcl Source Code

View Ticket
Login
Ticket UUID: 98006f00ac471be55d983d6a42606abc38f1d809
Title: tcl::mathfunc::isunordered inconsistency with some integer values
Type: Bug Version: 8.7+
Submitter: juliannoble2 Created on: 2024-12-27 02:12:24
Subsystem: - New Builtin Commands Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2024-12-28 14:09:06
Resolution: Fixed Closed By: sebres
    Closed on: 2024-12-28 14:09:06
Description:
Tested on various windows builds only.

isunordered unexpectedly returns 1 for a range of negative values when they are expressed in integer form. 

I'm not sure of the usecase for negative values here, but it doesn't seem to match the documentation as they should be promotable to floats, and as neither argument is NaN - the 1 returns are unexpected.

%tcl::mathfunc::isunordered 1 -1.0
0
%tcl::mathfunc::isunordered 1 -1
1

This occurs for negative values expressed in integer form up to negative 2**52
for numbers below that - we again get a zero result.

%tcl::mathfunc::isunordered 1 -4503599627370495
1
%tcl::mathfunc::isunordered 1 -4503599627370496
0
User Comments: sebres added on 2024-12-28 14:09:06:

Indeed, values of FP_* are compiler/implementation specific, e. g. for MSVC FP_NORMAL is equal -1, thus rewritten without FP_CLS_ERROR, because error-prone (whatever corrected value could still cross them later by some other platforms/compilers).
Fixed now in [3059fadfe6daf175].


jan.nijtmans added on 2024-12-28 09:43:56:

There are still test failures with MSVC on Windows


sebres added on 2024-12-27 21:23:22:

Indeed, tcl::mathfunc::isunordered has mistakenly considered non-double numbers (e.g. int) as double.
Fixed for 8.7+, thanks for the report.