#include <math.h> double sqrt(double x);
sqrt
computes the square root of its argument x
.
sqrt
returns the positive square root of x
, expressed as a
double-precision, floating-point number.
x
, the function returns 0.0, and the run-time
library writes an error message to stderr
(the standard error file).
If an error occurs in sqrt
, the _matherr
routine is called. You
can supply your own version of _matherr
to suppress the diagnostic
message or modify the value returned.
#include <math.h> #include <stdio.h> main() { double x; puts("Enter the number you want the square root of: "); scanf("%lf", &x); printf("The square root of %f is %fn", x, sqrt(x)); }
hypot
, _matherr
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.