X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fmath%2Fcbrt.c;h=12fc59e3c4493cf93e2f8db44636ed06817d95a1;hp=cf6d16b8a0376ed73c0fa06c8f7891dbb00a6017;hb=1d9d92ba957a0b8307c9a65c35867fde68e6533b;hpb=34893ecc2200dc7017c36a54cb6c5f4c2378b5ec diff --git a/functions/math/cbrt.c b/functions/math/cbrt.c index cf6d16b..12fc59e 100644 --- a/functions/math/cbrt.c +++ b/functions/math/cbrt.c @@ -1,19 +1,23 @@ -// ---------------------------------------------------------------------------- -// $Id$ -// ---------------------------------------------------------------------------- -// Public Domain C Library - http://pdclib.sourceforge.net -// This code is Public Domain. Use, modify, and redistribute at will. -// ---------------------------------------------------------------------------- +/* ---------------------------------------------------------------------------- + * $Id$ + * ---------------------------------------------------------------------------- + * Public Domain C Library - http://pdclib.sourceforge.net + * This code is Public Domain. Use, modify, and redistribute at will. + * --------------------------------------------------------------------------*/ -// ---------------------------------------------------------------------------- -// C++ - -float cbrt( float x ) { /* TODO */ }; -long double cbrt( long double x ) { /* TODO */ }; +double cbrt( double x ) { /* TODO */ }; -// ---------------------------------------------------------------------------- -// Standard C +/* Therx code +{ + double i = x / 4; + // (15 DP) HOW GET MORE? + while ( ( fabs( i - ( x / i / i ) ) / i ) > 0.00000000000001 ) + { + i = ( i + ( x / i / i ) + i ) / 3; + } + return i; +} +*/ -double cbrt( double x ) { /* TODO */ }; float cbrtf( float x ) { /* TODO */ }; long double cbrtl( long double x ) { /* TODO */ };