xref: /openbsd-src/lib/libm/man/sqrt.3 (revision f420855876ea7e2c0d9883f924d7fdd743d5f924)
1*f4208558Sschwarze.\"	$OpenBSD: sqrt.3,v 1.18 2021/06/29 14:04:16 schwarze Exp $
2df930be7Sderaadt.\" Copyright (c) 1985, 1991 Regents of the University of California.
3df930be7Sderaadt.\" All rights reserved.
4df930be7Sderaadt.\"
5df930be7Sderaadt.\" Redistribution and use in source and binary forms, with or without
6df930be7Sderaadt.\" modification, are permitted provided that the following conditions
7df930be7Sderaadt.\" are met:
8df930be7Sderaadt.\" 1. Redistributions of source code must retain the above copyright
9df930be7Sderaadt.\"    notice, this list of conditions and the following disclaimer.
10df930be7Sderaadt.\" 2. Redistributions in binary form must reproduce the above copyright
11df930be7Sderaadt.\"    notice, this list of conditions and the following disclaimer in the
12df930be7Sderaadt.\"    documentation and/or other materials provided with the distribution.
136580fee3Smillert.\" 3. Neither the name of the University nor the names of its contributors
14df930be7Sderaadt.\"    may be used to endorse or promote products derived from this software
15df930be7Sderaadt.\"    without specific prior written permission.
16df930be7Sderaadt.\"
17df930be7Sderaadt.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18df930be7Sderaadt.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19df930be7Sderaadt.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20df930be7Sderaadt.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21df930be7Sderaadt.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22df930be7Sderaadt.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23df930be7Sderaadt.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24df930be7Sderaadt.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25df930be7Sderaadt.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26df930be7Sderaadt.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27df930be7Sderaadt.\" SUCH DAMAGE.
28df930be7Sderaadt.\"
29df930be7Sderaadt.\"     from: @(#)sqrt.3	6.4 (Berkeley) 5/6/91
30df930be7Sderaadt.\"
31*f4208558Sschwarze.Dd $Mdocdate: June 29 2021 $
32df930be7Sderaadt.Dt SQRT 3
33df930be7Sderaadt.Os
34df930be7Sderaadt.Sh NAME
35df930be7Sderaadt.Nm cbrt ,
368a2f5500Sderaadt.Nm cbrtf ,
377ac6a943Smartynas.Nm cbrtl ,
388a2f5500Sderaadt.Nm sqrt ,
39854ac34eSmartynas.Nm sqrtf ,
40854ac34eSmartynas.Nm sqrtl
41df930be7Sderaadt.Nd cube root and square root functions
42df930be7Sderaadt.Sh SYNOPSIS
4386f9d4cdStedu.In math.h
44df930be7Sderaadt.Ft double
45df930be7Sderaadt.Fn cbrt "double x"
46df930be7Sderaadt.Ft float
47df930be7Sderaadt.Fn cbrtf "float x"
487ac6a943Smartynas.Ft long double
497ac6a943Smartynas.Fn cbrtl "long double x"
50df930be7Sderaadt.Ft double
51df930be7Sderaadt.Fn sqrt "double x"
52df930be7Sderaadt.Ft float
53df930be7Sderaadt.Fn sqrtf "float x"
54854ac34eSmartynas.Ft long double
55854ac34eSmartynas.Fn sqrtl "long double x"
56df930be7Sderaadt.Sh DESCRIPTION
57df930be7SderaadtThe
58df930be7Sderaadt.Fn cbrt
5907fc7eacSjasonfunction computes the cube root of
60*f4208558Sschwarze.Fa x .
6107fc7eacSjasonThe
6207fc7eacSjason.Fn cbrtf
6307fc7eacSjasonfunction is a single precision version of
6407fc7eacSjason.Fn cbrt .
657ac6a943SmartynasThe
667ac6a943Smartynas.Fn cbrtl
677ac6a943Smartynasfunction is an extended precision version of
687ac6a943Smartynas.Fn cbrt .
69df930be7Sderaadt.Pp
70df930be7SderaadtThe
71df930be7Sderaadt.Fn sqrt
7207fc7eacSjasonfunction computes
73*f4208558Sschwarzethe non-negative square root of
74*f4208558Sschwarze.Fa x .
7507fc7eacSjasonThe
7607fc7eacSjason.Fn sqrtf
7707fc7eacSjasonfunction is a single precision version of
7807fc7eacSjason.Fn sqrt .
79854ac34eSmartynasThe
80854ac34eSmartynas.Fn sqrtl
81854ac34eSmartynasfunction is an extended precision version of
82854ac34eSmartynas.Fn sqrt .
83df930be7Sderaadt.Sh RETURN VALUES
84*f4208558SschwarzeIf
85*f4208558Sschwarze.Fa x
86*f4208558Sschwarzeis negative,
87854ac34eSmartynas.Fn sqrt "x" ,
88f0525d41Stholo.Fn sqrtf "x"
89854ac34eSmartynasand
90854ac34eSmartynas.Fn sqrtl "x"
912fc7c3e3Sjasonset the global variable
92f0525d41Stholo.Va errno
93*f4208558Sschwarzeto
94*f4208558Sschwarze.Er EDOM .
95df930be7Sderaadt.Sh HISTORY
9623fbb714SschwarzeA
9723fbb714Sschwarze.Fn sqrt
9823fbb714Sschwarzefunction first appeared in
9901c04610Sjsg.At v2 .
10023fbb714Sschwarze.Pp
101df930be7SderaadtThe
102df930be7Sderaadt.Fn cbrt
103df930be7Sderaadtfunction appeared in
104df930be7Sderaadt.Bx 4.3 .
105