Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2006-09-01
03:42 • Closed ticket [1541274fff]: sqrt(-1) gives -NaN plus 8 other changes artifact: a0c63a726e user: dgp
03:12 • Open ticket [1541274fff]. artifact: b591a6b0cb user: dgp
2006-08-31
09:20 • Closed ticket [1541274fff]. artifact: b9ace511ba user: sf-robot
2006-08-16
22:04 • Pending ticket [1541274fff]. artifact: 615638f730 user: dgp
12:53 • New ticket [1541274fff]. artifact: 2d799c99e1 user: nobody

sqrt(-1) gives -NaN

Closed / Fixed1541274fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 20 years ago
Descriptionplain2006-08-16 12:53:42
 % expr sqrt(-1)
-NaN

Does this have a reason in the IEEE standard?
Richard Suchenwirth
dgpplain2006-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-robotplain2006-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).
dgpplain2006-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)
dgpplain2006-09-01 03:42:13
Logged In: YES 
user_id=80530

fix committed
Log in (anonymous is fine) to add a comment.