Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Java oddity

Author: Vincent Diepeveen

Date: 10:38:16 09/10/02

Go up one level in this thread


On September 09, 2002 at 23:06:36, Robert Hyatt wrote:

>On September 09, 2002 at 12:05:27, Vincent Diepeveen wrote:
>
>>On September 09, 2002 at 10:04:12, Ed Panek wrote:
>>
>>Which compiler did you use?
>>
>>It is exactly these reasons that i was very sick from
>>intel c++ compiler, because it is doing everything
>>wrong with casts of floating point math.
>>you write 'java oddity' above. intel j++ exists nowadays?
>
>It isn't a compiler problem it is an IEEE floating point problem in that
>.1 can not be comverted exactly, it becomes an approximation.

Yes that's what he is talking about, but i'm talking about
other major bugs inthe compiler which causes random values.

>
>2.01 == 2.009997 roughly.  * 1000 = 2009.997, truncated to a long gives
>2009.  No bug.  No error.   Floating point conversion followed by integer
>conversion makes this natural.
>
>
>
>
>
>>
>>>long x;
>>>double y;
>>>
>>>y = 2.01;
>>>x = (long)(y * 1000);
>>>
>>>
>>>guess what x equals? ...
>>>
>>>No, not 2010, but 2009 !!!!!!!!!!!!!!!
>>>
>>>Ed



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.