Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Java oddity

Author: Robert Hyatt

Date: 11:49:45 09/10/02

Go up one level in this thread


On September 10, 2002 at 13:39:13, Vincent Diepeveen wrote:

>On September 09, 2002 at 23:11:47, Robert Hyatt wrote:
>
>>On September 09, 2002 at 14:05:30, Vincent Diepeveen wrote:
>>
>>>On September 09, 2002 at 13:32:42, Ed Panek wrote:
>>>
>>>use a different compiler. gcc 3.2 or something instead of 5 years old
>>>RH6.
>>>
>>>It's like me blaming m$ for bugs in windows NT 4.0 which is from 1995.
>>
>>
>>Same here.  This is _not_ a compiler bug.  It is a simply an artifact of
>>using floating point math.  Well-known to those of us that have done this
>>very much.
>
>try the example i gave for the intel c++ compiler.
>


It works fine for me:

Here is the simple source:

#include <stdio.h>
int myfunct(float a,float b,float c) {
  return((int)(a*b+c));
}
main () {
  int myfunct(float,float,float);
  float a=2.5, b=4.0, c=12.0;
  int result;
  result=myfunct(a,b,c);
  printf("a=%f  b=%f  c=%f\n",a,b,c);
  printf("result=%d\n",result);
}

compiled like this:

icc -o tstx tstx.c

And executed:

crafty% ./tstx
a=2.500000  b=4.000000  c=12.000000


I don't see any problem whatsoever.

in fact, several here are using that compiler for numerical floating point
applications and they have tested the accuracy very carefully...





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.