1.\" Copyright (c) 1985, 1991 Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by the University of 15.\" California, Berkeley and its contributors. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" from: @(#)sqrt.3 6.4 (Berkeley) 5/6/91 33.\" $Id$ 34.\" 35.Dd May 6, 1991 36.Dt SQRT 3 37.Os 38.Sh NAME 39.Nm cbrt , 40.Nm cbrtf , 41.Nm sqrt , 42.Nm sqrtf 43.Nd cube root and square root functions 44.Sh SYNOPSIS 45.Fd #include <math.h> 46.Ft double 47.Fn cbrt "double x" 48.Ft float 49.Fn cbrtf "float x" 50.Ft double 51.Fn sqrt "double x" 52.Ft float 53.Fn sqrtf "float x" 54.Sh DESCRIPTION 55The 56.Fn cbrt 57and the 58.Fn cbrtf 59functions compute 60the cube root of 61.Ar x . 62.Pp 63The 64.Fn sqrt 65and the 66.Fn sqrtf 67functions compute the 68non-negative square root of x. 69.Sh RETURN VALUES 70The 71.Fn cbrt 72and the 73.Fn cbrtf 74functions return the requested cube root. 75The 76.Fn sqrt 77and the 78.Fn sqrtf 79functions return the requested square root 80unless an error occurs. 81On the 82.Tn VAX 83or 84.Tn Tahoe 85processor an attempt to take the 86.Fn sqrt 87of negative 88.Fa x 89causes an error; in this event, 90the global variable 91.Va errno 92is set to 93.Dv EDOM 94and a reserved operand fault is generated. 95.Sh ERROR (due to Roundoff etc.) 96The 97.Fn cbrt 98function 99is accurate to within 0.7 100.Em ulps . 101.Pp 102The 103.Fn sqrt 104function on a 105.Tn VAX 106is accurate to within 0.501 107.Em ulps . 108Sqrt on a machine that conforms to 109.Tn IEEE 110754 is correctly rounded 111in accordance with the rounding mode in force; the error is less than 112half an 113.Em ulp 114in the default mode (round\-to\-nearest). 115An 116.Em ulp 117is one 118.Em U Ns nit 119in the 120.Em L Ns ast 121.Em P Ns lace 122carried. 123.Sh SEE ALSO 124.Xr math 3 125.Sh STANDARDS 126The 127.Nm sqrt 128function conforms to 129.St -ansiC . 130.Sh HISTORY 131The 132.Nm cbrt 133function appeared in 134.Bx 4.3 . 135