Article View: borland.public.jbuilder.java.language
Article #19999Re: Floating point bug in vitrual machine?
From: Brian Burton
Date: Tue, 11 Nov 1997 00:00
Date: Tue, 11 Nov 1997 00:00
38 lines
1565 bytes
1565 bytes
512 can be represented with no loss of precision in IEEE floating point
formats. Integers are not a problem for floating point values as long as the
bits required to represent them fit into the mantissa of the floating point
format.
That looks like a VM bug to me.
All the best,
++Brian
Eric Nagler wrote:
>
> Yeah. It's how floating point numbers are stored internally --
> certainly not an exact representation. So it may actually be
> 511.99999999999, and then you truncate the fraction.
>
> On Tue, 11 Nov 1997 15:07:33 -0800, Antonio Garcia
> <garc_an@eng.printronix.com> wrote:
>
> >Try this:
> >
> > {
> > Float f = new Float(512.0);
> > int i = f.intValue();
> > System.out.println(i);
> > }
> >
> >I get 511 every time. Any ideas why?
> >
> >P133/Windows NT 4.0 SP 1/Jbuilder Pro
> >
> >--AG
--
Brian Burton Custom Software Development
Burton Computer Corporation Java, C++, Orbix, Tuxedo
http://www.burton-computer.com OO Consulting and Mentoring
Technical Details
Message-ID:
<346900F7.4D8A0C70@burton-computer.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3468E535.5AEB@eng.printronix.com> <346bf131.24828878@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,70cc12fd65535774 X-Google-Attributes: gidf74b3,public From: Brian Burton <brian.burton@burton-computer.com> Subject: Re: Floating point bug in vitrual machine? Date: 1997/11/11 Message-ID: <346900F7.4D8A0C70@burton-computer.com> X-Deja-AN: 288760463 References: <3468E535.5AEB@eng.printronix.com> <346bf131.24828878@forums.borland.com> Organization: Burton Computer Corporation Newsgroups: borland.public.jbuilder.java.language