Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!aplcen!boingo.med.jhu.edu!haven!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: In search of cbrt() ... Keywords: Gaphics Gems, cbrt() for TC++ Message-ID: <14739@smoke.brl.mil> Date: 14 Dec 90 20:55:06 GMT References: <14724@smoke.brl.mil> <4502@goanna.cs.rmit.oz.au> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 10 In article <4502@goanna.cs.rmit.oz.au> ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes: >> However, if all it does is extract a cube-root, it's trivial to emulate: >> #include >> #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. Obviously. And there are also complex cube roots, etc. I assumed that the operand was non-negative for simplicity, since it might be known to be so in the particular application.