Guardian Native C Library Calls Reference Manual (G06.28+, H06.04+)

Guardian Native C Library Calls (s) sqrt(3)
NAME
sqrt - Computes the square root of a oating-point number
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRESRL
G-series native OSS processes: /G/system/sysnn/zcresrl
H-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCREDLL
H-series OSS processes: /G/system/zdllnnn/zcredll
SYNOPSIS
#include <math.h>
double sqrt(
double x);
PARAMETERS
x Is the value whose square root is to be computed.
DESCRIPTION
The sqrt() function computes the square root of its parameter.
NOTES
This function supports both IEEE Std 754-1985 oating-point and Tandem oating-point values
in the native environment. IEEE values can include NaN, and innity and the sign of 0.0 (zero)
can be positive or negative. The class of an IEEE oating-point value can be determined using
the fp_class() function. Refer to the fp_class(3) reference page for a description of IEEE value
classes.
Guardian functions are available to convert between oating-point formats. Refer to the Guar-
dian Programmers Guide for a discussion of oating-point conversions.
RETURN VALUES
The sqrt() function returns the square root of x. The value of x must be positive or zero.
For IEEE oating-point data, if the value of x is NaN, NaN is returned. If the value of x is nega-
tive, NaN is returned and errno is set to [EDOM]. If the value of x is positive innity, positive
innity is returned.
For Tandem oating-point data, if the value of x is negative, 0.0 (zero) is returned and errno is
set to [EDOM].
ERRORS
If any of the following conditions occurs, the sqrt() function sets errno to the corresponding
value:
[EDOM] The value of the x parameter is negative.
RELATED INFORMATION
Functions: exp(3), fp_class(3), isnan(3).
STANDARDS CONFORMANCE
This function conforms to the XPG4 Version 2 specication with extensions when used for IEEE
oating-point data. This function conforms to the XPG4 Version 2 specication without exten-
sions when used for Tandem oating-point data.
The XPG4 Version 2 specication leaves some features to the implementing vendor to dene.
The following features are affected in the HP implementation:
For IEEE oating-point data, errno is not set to [EDOM] when the value of x is NaN.
527192-005 Hewlett-Packard Company 635