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: sqrt.3,v 1.3 1993/08/14 13:43:05 mycroft Exp $ 34.\" 35.Dd May 6, 1991 36.Dt SQRT 3 37.Os 38.Sh NAME 39.Nm cbrt , 40.Nm sqrt 41.Nd cube root and square root functions 42.Sh SYNOPSIS 43.Fd #include <math.h> 44.Ft double 45.Fn cbrt "double x" 46.Ft double 47.Fn sqrt "double x" 48.Sh DESCRIPTION 49The 50.Fn cbrt 51function computes 52the cube root of 53.Ar x . 54.Pp 55The 56.Fn sqrt 57computes the 58non-negative square root of x. 59.Sh RETURN VALUES 60The 61.Fn cbrt 62function returns the requested cube root. 63The 64.Fn sqrt 65function returns the requested square root 66unless an error occurs. 67On the 68.Tn VAX 69or 70.Tn Tahoe 71processor an attempt to take the 72.Fn sqrt 73of negative 74.Fa x 75causes an error; in this event, 76the global variable 77.Va errno 78is set to 79.Dv EDOM 80and a reserved operand fault is generated. 81.Sh ERROR (due to Roundoff etc.) 82The 83.Fn cbrt 84function 85is accurate to within 0.7 86.Em ulps . 87.Pp 88The 89.Fn sqrt 90function on a 91.Tn VAX 92is accurate to within 0.501 93.Em ulps . 94Sqrt on a machine that conforms to 95.Tn IEEE 96754 is correctly rounded 97in accordance with the rounding mode in force; the error is less than 98half an 99.Em ulp 100in the default mode (round\-to\-nearest). 101An 102.Em ulp 103is one 104.Em U Ns nit 105in the 106.Em L Ns ast 107.Em P Ns lace 108carried. 109.Sh SEE ALSO 110.Xr math 3 , 111.Xr infnan 3 112.Sh STANDARDS 113The 114.Nm sqrt 115function conforms to 116.St -ansiC . 117.Sh HISTORY 118The 119.Nm cbrt 120function appeared in 121.Bx 4.3 . 122