xref: /original-bsd/lib/libm/common_source/sqrt.3 (revision c3e32dec)
1.\" Copyright (c) 1985, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.roff%
5.\"
6.\"     @(#)sqrt.3	8.1 (Berkeley) 06/04/93
7.\"
8.Dd
9.Dt SQRT 3
10.Os
11.Sh NAME
12.Nm cbrt ,
13.Nm sqrt
14.Nd cube root and square root functions
15.Sh SYNOPSIS
16.Fd #include <math.h>
17.Ft double
18.Fn cbrt "double x"
19.Ft double
20.Fn sqrt "double x"
21.Sh DESCRIPTION
22The
23.Fn cbrt
24function computes
25the cube root of
26.Ar x .
27.Pp
28The
29.Fn sqrt
30computes the
31non-negative square root of x.
32.Sh RETURN VALUES
33The
34.Fn cbrt
35function returns the requested cube root.
36The
37.Fn sqrt
38function returns the requested square root
39unless an error occurs.
40On the
41.Tn VAX
42or
43.Tn Tahoe
44processor an attempt to take the
45.Fn sqrt
46of negative
47.Fa x
48causes an error; in this event,
49the global variable
50.Va errno
51is set to
52.Dv EDOM
53and a reserved operand fault is generated.
54.Sh ERROR (due to Roundoff etc.)
55The
56.Fn cbrt
57function
58is accurate to within 0.7
59.Em ulps .
60.Pp
61The
62.Fn sqrt
63function on a
64.Tn VAX
65is accurate to within 0.501
66.Em ulps .
67Sqrt on a machine that conforms to
68.Tn IEEE
69754 is correctly rounded
70in accordance with the rounding mode in force; the error is less than
71half an
72.Em ulp
73in the default mode (round\-to\-nearest).
74An
75.Em ulp
76is one
77.Em U Ns nit
78in the
79.Em L Ns ast
80.Em P Ns lace
81carried.
82.Sh SEE ALSO
83.Xr math 3 ,
84.Xr infnan 3
85.Sh STANDARDS
86The
87.Nm sqrt
88function conforms to
89.St -ansiC .
90.Sh HISTORY
91The
92.Nm cbrt
93function appeared in
94.Bx 4.3 .
95