Name

cbrt, cbrtf, cbrtl, sqrt, sqrtf, sqrtl
- square root function

Library

libm.lib

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);

Return values

The cbrt and cbrtf functions return the requested cube root. The sqrt and sqrtf functions return the requested square root unless an error occurs. An attempt to take the sqrt of negative x causes an NaN to be returned.

Detailed description

The cbrt and cbrtf functions compute the cube root of x. The function cbrtl is an alias to the function cbrt.

The sqrt and sqrtf functions compute the non-negative square root of x. The function sqrtl is an alias to the function sqrt.


Examples

#include <math.h>
int main( )
{
   double inp = -0.001;
   double y;
   y = cbrt( inp );
   printf( "cbrt( %f)  = %f\n", x1,  y );
   y = cbrtf( inp);
   printf( "cbrtf( %f) = %f\n", inp, y );
   y = cbrtl( inp);
   printf( "cbrtl( %f) = %f\n\n", inp, y );
   inp = 2209.0;
   y = sqrt( inp);
   printf( "sqrt( %f)  = %d\n", inp,  y );
   y = sqrtf( inp);
   printf( "sqrtf( %f) = %d\n", inp, y );
   y = sqrtl( inp);
   printf( "sqrtl( %f) = %d\n", inp, y );
}

         

Output

cbrt ( -0.001 ) = -0.100000
cbrtf( -0.001 ) = -0.100000
cbrtl( -0.001 ) = -0.100000
sqrt ( 2209.0 ) = 47.0
sqrtf( 2209.0 ) = 47.0
sqrtl( 2209.0 ) = 47.0

         


See also

math

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top