Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sqrt(3) [osx man page]

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

NAME
sqrt -- square root function SYNOPSIS
#include <math.h> double sqrt(double x); long double sqrtl(long double x); float sqrtf(float x); DESCRIPTION
The sqrt() function compute the non-negative square root of x. SPECIAL VALUES
sqrt(-0) returns -0. sqrt(x) returns a NaN and generates a domain error for x < 0. VECTOR OPERATIONS
If you need to apply the sqrt() function to SIMD vectors or arrays, using the following functions provided by the Accelerate.framework may give significantly better performance: #include <Accelerate/Accelerate.h> vFloat vsqrtf(vFloat x); vFloat vrsqrtf(vFloat x); void vvsqrtf(float *y, const float *x, const int *n); void vvsqrt(double *y, const double *x, const int *n); void vvrsqrtf(float *y, const float *x, const int *n); void vvrsqrt(double *y, const double *x, const int *n); SEE ALSO
math(3) STANDARDS
The sqrt() function conforms to ISO/IEC 9899:2011. BSD
December 11, 2006 BSD

Check Out this Related Man Page

COS(3)							   BSD Library Functions Manual 						    COS(3)

NAME
cos -- cosine function SYNOPSIS
#include <math.h> double cos(double x); long double cosl(long double x); float cosf(float x); DESCRIPTION
The cos() function computes the cosine of x (measured in radians). SPECIAL VALUES
cos(+-0) returns 1. cos(+-infinity) returns a NaN and raises the "invalid" floating-point exception. VECTOR OPERATIONS
If you need to apply the cos() function to SIMD vectors or arrays, using the following functions provided by the Accelerate.framework may give significantly better performance: #include <Accelerate/Accelerate.h> vFloat vcosf(vFloat x); vFloat vsincosf(vFloat x, vFloat *c); void vvcosf(float *y, const float *x, const int *n); void vvcos(double *y, const double *x, const int *n); void vvsincosf(float *s, float *c, const float *x, const int *n); void vvsincos(double *s, double *c, const double *x, const int *n); SEE ALSO
sin(3), tan(3), asin(3), acos(3), atan(3), atan2(3), sinh(3), cosh(3), tanh(3), math(3) STANDARDS
The cos() function conforms to ISO/IEC 9899:2011. BSD
December 11, 2006 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