Sun Microsystems, Inc.
spacerspacer
spacer   www.sun.com docs.sun.com | | |  
spacer
black dot
   
A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z
    
 
Mathematical Library Functionssqrt(3M)


NAME

 sqrt - square root function

SYNOPSIS

 
cc [ flag ... ] file ... -lm [ library ... ]
#include <math.h>
double sqrt(double x);

DESCRIPTION

 

The sqrt() function computes the square root of x.

RETURN VALUES

 

Upon successful completion, sqrt() returns the square root of x.

If x is NaN, NaN is returned.

If x is negative, NaN is returned and errno is set to EDOM.

ERRORS

 

The sqrt() function will fail if:

EDOM
The value of x is negative.

USAGE

 

An application wishing to check for error situations should set errno to 0 before calling sqrt(). If errno is non-zero on return, or the return value is NaN, an error has occurred.

ATTRIBUTES

 

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPEATTRIBUTE VALUE
MT-LevelMT-Safe

SEE ALSO

 

isnan(3M), attributes(5)


SunOS 5.9Go To TopLast Changed 29 Dec 1996

 
      
      
Copyright 2002 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.