Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Dec 1994 21:33:21 -0500
From:      Thomas David Rivers <rivers%ponds@ncren.net>
To:        freebsd-questions@freebsd.org, markd@grizzly.com
Subject:   Re: Behavior of sqrt on errors.
Message-ID:  <199412300233.VAA19033@ponds.UUCP>

next in thread | raw e-mail | index | archive | help
> 
> 
> On FreeBSD,
> 
>    sqrt (-3.0);
> 
> generates a SIGFPE.  On all other systems I have encountered, it calls
> matherr with a DOMAIN error.  Can anyone more knowledgeable about the 
> ANSI standard comment if this correct ANSI behavior or a bug?
> 
> Thanks,
> Mark
> 

 From the sqrt(3) man page:

                                                          The sqrt() function
     returns the requested square root unless an error occurs.  On the VAX or
     Tahoe processor an attempt to take the sqrt() of negative x causes an er-
     ror; in this event, the global variable errno is set to EDOM and a re-
     served operand fault is generated.

 So, the man page implies this is working as designed.

	- Dave Rivers -



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199412300233.VAA19033>