Article View: borland.public.jbuilder.java.language
Article #19998Re: Floating point bug in vitrual machine?
From: Eric Nagler
Date: Tue, 11 Nov 1997 00:00
Date: Tue, 11 Nov 1997 00:00
21 lines
912 bytes
912 bytes
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
Technical Details
Message-ID:
<346bf131.24828878@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3468E535.5AEB@eng.printronix.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: 76711.521@compuserve.com (Eric Nagler) Subject: Re: Floating point bug in vitrual machine? Date: 1997/11/11 Message-ID: <346bf131.24828878@forums.borland.com> X-Deja-AN: 288741408 References: <3468E535.5AEB@eng.printronix.com> Organization: TeamB Newsgroups: borland.public.jbuilder.java.language