;-)
My point exactly.
-Andy
On Sat, 2002-04-20 at 08:38, Glen Stampoultzis wrote:
> Ohh, damn. I just fixed this before seeing this mail... drat...
>
> -- Glen
>
>
> ----- Original Message -----
> From: "Andrew C. Oliver" <[EMAIL PROTECTED]>
> To: "Rolf-J�rgen Moll" <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> Sent: Saturday, April 20, 2002 3:50 AM
> Subject: Re: POI -> Excel: Bug in decoding floating numbers
>
>
> > Don't take this the wrong way, but please don't email me this stuff
> > directly, please follow the procedure of creating a patch with cvs diff
> > -u and posting it in bugzilla with [PATCH] in the subject. You've
> > tracked down a much needed bugfix, but sending it to me is the slowest
> > possible way to get it applied.
> >
> > -Andy "the POI bottleneck"
> >
> > Rolf-J�rgen Moll wrote:
> >
> > >Dear Oliver,
> > >
> > >we are using POI to import data from excel sheets into our application
> > >(financial accounting and planning).
> > >
> > >
> > >It seems that I found a bug in the decodeNumber-methods of RKRecord and
> > >MulRKRecord. When you try to read out the value 9324.62 from a cell,
> without
> > >my modifications it will be encoded to 9324.625!
> > >
> > >With the modifications it works properly!
> > >
> > >It would be great if you could update the source in the POI-project and
> if
> > >you could inform me about this.
> > >
> > >Open source is really great! If there's a bug, you have the chance to
> find
> > >and fix it.
> > >
> > >
> > >The proper code is for both classes RKRecord and MulRKRecord:
> > >
> > > private static double decodeNumber(int number)
> > > {
> > > long raw_number = number;
> > >
> > > // mask off the two low-order bits, 'cause they're not part of
> > > // the number
> > > // old: raw_number &= -3;
> > > raw_number = raw_number >> 2; // new
> > >
> > > double rvalue = 0;
> > >
> > > if ((number & 0x02) == 0x02)
> > > {
> > >
> > > // ok, it's just a plain ol' int; we can handle this
> > > // trivially by right-shifting and casting
> > > // old: rvalue = ( double ) (raw_number >> 2);
> > > rvalue = ( double ) (raw_number); // new
> > > }
> > > else
> > > {
> > >
> > > // also trivial, but not as obvious ... left shift the
> > > // bits high and use that clever static method in Double
> > > // to convert the resulting bit image to a double
> > > // old rvalue = Double.longBitsToDouble(raw_number << 32);
> > > rvalue = Double.longBitsToDouble(raw_number << 34);
> > > }
> > > if ((number & 0x01) == 0x01)
> > > {
> > >
> > > // low-order bit says divide by 100, and so we do. Why?
> > > // 'cause that's what the algorithm says. Can't fight city
> > > // hall, especially if it's the city of Redmond
> > > rvalue /= 100;
> > > }
> > > return rvalue;
> > > }
> > >
> > >Sincerely yours,
> > >
> > >ROLF-JUERGEN MOLL
> > >--------------------------------------------
> > >LucaNet AG
> > >Hanauer Str. 14b
> > >80992 M�nchen
> > >Telefon: +49 (089) 51 999 804
> > >Telefax: +49 (089) 51 999 796
> > >
> > >www.lucanet.de
> > >--------------------------------------------
> > >
> > >
> > >
> >
> >
> >
>
>
--
http://www.superlinksoftware.com
http://jakarta.apache.org/poi - port of Excel/Word/OLE 2 Compound
Document
format to java
http://developer.java.sun.com/developer/bugParade/bugs/4487555.html
- fix java generics!
The avalanche has already started. It is too late for the pebbles to
vote.
-Ambassador Kosh