Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cs.yale.edu!weedeater.math.yale.edu!craig From: craig@weedeater.math.yale.edu (Craig Kolb) Newsgroups: comp.lang.c Subject: Re: In search of cbrt() ... Summary: EAH To The Rescue! Keywords: Gaphics Gems, cbrt() for TC++ Message-ID: <27771@cs.yale.edu> Date: 13 Dec 90 02:10:33 GMT References: Sender: news@cs.yale.edu Distribution: na Organization: Yale University Department of Mathematics Lines: 22 Nntp-Posting-Host: weedeater.math.yale.edu In article rcruz@paul.rutgers.edu (Rafael Cruz) writes: >However, the routines to compute cubic and >quartic roots make use of the library function cbrt(). This library >is in the Unix math library but TC doesn't seem to support it. Sad but true. Many math libraries don't have a cbrt(). Eric Haines was kind enough to point out this problem and to provide the fix that appears in the latest Graphics Gems distribution on weedeater.math.yale.edu:~ftp/pub/GraphicsGems/src: #ifdef NOCBRT #define cbrt(x) ((x) > 0.0 ? pow((double)(x), 1.0/3.0) : \ ((x) < 0.0 ? -pow((double)-(x), 1.0/3.0) : 0.0)) #endif Stick the above lines in the header of Roots3And4.c, define NOCBRT, and you should be all set. Craig