Tcl Source Code

View Ticket
Login
Ticket UUID: 1541274
Title: sqrt(-1) gives -NaN
Type: Bug Created on: 2006-08-16 12:53:42
Submitter: nobody Assigned to: dgp
Subsystem: 47. Bytecode Compiler Severity:
Priority: 5 Medium Last modified: 2006-09-01 03:42:13
Status: Closed Closed by: dgp
Resolution: Fixed Closed on: 2006-08-31 20:42:13
Version: obsolete: 8.5a4
Description:
 % expr sqrt(-1)
-NaN

Does this have a reason in the IEEE standard?
Richard Suchenwirth
User Comments:
dgp added on 2006-08-16 22:04:08:
Logged In: YES 
user_id=80530



[tcl::mathfunc::sqrt] returns
whatever the libm sqrt() C
function does.  On Solaris 9:

% tcl::mathfunc::sqrt -1    
NaN(7ffffffffffff)

Does that answer the Q?

sf-robot added on 2006-08-31 09:20:34:
Logged In: YES 
user_id=1312539

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).

dgp added on 2006-09-01 03:12:22:
Logged In: YES 
user_id=80530


There is a real bug here:

% set x -1
-1
% expr {sqrt($x)}
domain error: argument not in valid range
% expr {sqrt(-1)}
NaN(7ffffffffffff)

dgp added on 2006-09-01 03:42:13:
Logged In: YES 
user_id=80530

fix committed