Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sqrt(3m) [ultrix man page]

sqrt(3m)																  sqrt(3m)

Name
       cbrt, sqrt - cube root, square root

Syntax
       #include <math.h>

       double cbrt(x)
       double x;

       double sqrt(x)
       double x;

       float fsqrt(float x)
       float x;

Description
       The function returns the cube root of x.

       The and functions return the square root of x for double and float data types respectively.

   Error Due to Roundoff and Other Reasons
       The function is accurate to within 0.7 ulps.

       The function on this machine conforms to IEEE 754 and is correctly rounded in accordance with the rounding mode in force; the error is less
       than half an ulp in the default mode (round-to-nearest).  An ulp is one Unit in the Last Place carried.

Diagnostics
       The function returns the default quiet NaN when x is negative indicating the invalid operation.

See Also
       math(3m)

								       RISC								  sqrt(3m)

Check Out this Related Man Page

SQRT(3) 						   BSD Library Functions Manual 						   SQRT(3)

NAME
cbrt, cbrtf, cbrtl, sqrt, sqrtf, sqrtl -- cube root and square root functions LIBRARY
Math Library (libm, -lm) SYNOPSIS
#include <math.h> double cbrt(double x); float cbrtf(float x); long double cbrtl(long double x); double sqrt(double x); float sqrtf(float x); long double sqrtl(long double x); DESCRIPTION
The cbrt(), cbrtf(), and cbrtl() functions compute the cube root of x. The sqrt(), sqrtf(), and sqrtl() functions compute the non-negative square root of x. RETURN VALUES
The cbrt(), cbrtf(), and cbrtl() functions return the requested cube root. The sqrt(), sqrtf(), and sqrtl() functions return the requested square root unless an error occurs. An attempt to take the sqrt() of negative x raises an invalid exception and causes an NaN to be returned (except that the square root of -0 is valid and equal to -0.) SEE ALSO
fenv(3), math(3) STANDARDS
The cbrt(), cbrtf(), cbrtl(), sqrt(), sqrtf(), and sqrtl() functions conform to ISO/IEC 9899:1999 (``ISO C99''). HISTORY
The cbrt() function appeared in 4.3BSD. The sqrtl() function appeared in FreeBSD 8.0. The cbrtl() function appeared in FreeBSD 9.0. BSD
March 5, 2011 BSD
Man Page

7 More Discussions You Might Find Interesting

1. Programming

sqrt

Hi! when i'm trying to compile this lite example on my linux machine I'll get errors and i don't know why.. #include <stdio.h> #include <math.h> /* needed by sqrt() */ int main() { printf("%f", sqrt(10.0)); return (0); } this is the error: /tmp/cc33hNVHK.o: In function... (1 Reply)
Discussion started by: CreamHarry
1 Replies

2. Programming

sqrt is not find???

I was writing a simple program in linux, which includes sqrt function of c. I included the math.h. But when I use gcc to compile it, it gave an error message: /home/murat/tmp/ccOv9upo.o(.text+0x4b): In function `main': : undefined reference to `sqrt' collect2: ld returned 1 exit status I... (2 Replies)
Discussion started by: murataht
2 Replies

3. Shell Programming and Scripting

How to create SQRT function in catenate file

HI, I have a file which i catenate and using the fields in the file, I would like to get sqrt of it. I tried to man the function but it normally would need an echo as well as bc. What I am intending to find out is catenate a file where let say cat a.txt| awk ' { t= h*($3+$2); t=... (7 Replies)
Discussion started by: ahjiefreak
7 Replies

4. Shell Programming and Scripting

how can i find sqrt of a any number without using expr

hi friends can any body tell me how can i find sqrt of a any given number without using expr in bash shell while i am doing i got some errors please take a look and code is here x=$((( ( sqrt($1) ) | bc ))) echo $x $ sh quadratic-eqn-roots.sh 9 quadratic-eqn-roots.sh: line 12: ( (... (6 Replies)
Discussion started by: srinivas2828
6 Replies

5. Programming

C Library reference error using sqrt() - will not compile.

This so basic that it should work.... Any ideas would be appreciared. Using a number directly in the sqrt allows it to compile. primrose > cat a.c #include <stdio.h> #include <math.h> int main(void) { double abcd=9; printf("%f\n",sqrt(abcd)); } primrose > gcc a.c Undefined first... (2 Replies)
Discussion started by: plastichead
2 Replies

6. UNIX for Dummies Questions & Answers

sqrt in bash

Hi, i have a the following script: #!/bin/bash a=3 b=9 let "c= b*a" let "d=sqrt $c " echo $d But when i execute the code, it gives me the an error saying: line 5: let: d=sqrt 27 : syntax error in expression (error token is "27 ") Can any body tell me what I'm doing wrong? (5 Replies)
Discussion started by: limadario
5 Replies

7. Shell Programming and Scripting

Q: Is SQRT(n) possible in a POSIX compliant shell? A: Yes within limits.

Hi all... This is just a fun project to see if it is possible to get a square root of a positive integer from 1 to 9200000 to 6 decimal places on a 64 bit architecture machine. It is coded around dash and the results show the values from 0 to 10000. Complex numbers can easily be catered for by... (3 Replies)
Discussion started by: wisecracker
3 Replies