In search of cbrt() ...

Richard A. O'Keefe ok at goanna.cs.rmit.oz.au
Fri Dec 14 17:09:11 AEST 1990


In article <14724 at smoke.brl.mil>, gwyn at smoke.brl.mil (Doug Gwyn) writes:
> In article <Dec.12.18.31.04.1990.3356 at paul.rutgers.edu> rcruz at paul.rutgers.edu (Rafael Cruz) writes:
> >... make use of the library function cbrt().

cbrt() is part of the Berkeley math library.

> However, if all it does is extract a cube-root, it's trivial to emulate:
> 	#include <math.h>
> 	#define cubrt(x) pow(x,1.0/3.0)

That doesn't quite do the job.  cbrt(-8.0) is -2.0, but pow(-8.0, 1.0/3.0)
prints "DOMAIN error" and returns 0.0.

-- 
The Marxists have merely _interpreted_ Marxism in various ways;
the point, however, is to _change_ it.		-- R. Hochhuth.



More information about the Comp.lang.c mailing list