cbrt


cbrt

Calculates the cube root of a number

 #include <math.h> double cbrt ( double x  ); float cbrtf ( float x  ); long double cbrtl ( long double x  ); 

The cbrt( ) functions return the cube root of their argument x.

Example

 #define KM_PER_AU (149597870.691) // An astronomical unit is the mean                                   // distance between Earth and Sun:                                   // about 150 million km. #define DY_PER_YR (365.24) double dist_au, dist_km, period_dy, period_yr; printf( "How long is a solar year on your planet (in Earth days)?\n" ); scanf( "%lf", &period_dy ); period_yr = period_dy / DY_PER_YR; dist_au = cbrt( period_yr * period_yr );    // by Kepler's Third Law dist_km = dist_au * KM_PER_AU; printf( "Then your planet must be about %.0lf km from the Sun.\n", sma_km ); 

See Also

sqrt( ), hypot( ), pow( )



C(c) In a Nutshell
C in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596006977
EAN: 2147483647
Year: 2006
Pages: 473

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net