On Thu, 2006-07-13 at 19:46 +0200, Carsten Neumann wrote: > Hi, > > the attached patch implements java.lang.StrictMath#cbrt, but I'm > actually quite ashamed to post it: I'm not very knowledgeable about > floating point arithmetic, so I just followed the implementation in > fdlibm (www.netlib.org/fdlibm). Unfortunately this library does some > weird manipulations of the bits of a double, which I simply mimicked in > java.
That's probably okay though. Actually it's probably a lot better coding practice to do it in Java than in C since Java at least has a strictly defined idea of what a double is. (A bigger problem with some VMs (*cough* GCJ) is that the internal representation of a double isn't right. E.g. the might use the processors extended 80-bit doubles *cough* instead of IEEE 64-bit ones) One question though.. would it make sense to use longs instead of int[2] for the 'word' stuff? You could use the Double.doubleFromRawLong method to convert back to double then. /Sven
