Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Integer or Floating Point for Scoring?

Author: Dann Corbit

Date: 10:45:26 02/09/99

Go up one level in this thread


On February 09, 1999 at 13:28:09, Larry Griffiths wrote:

>On February 09, 1999 at 02:49:17, Dann Corbit wrote:
>
>>On February 09, 1999 at 02:43:52, Larry Griffiths wrote:
>>
>>>I have been using Floating point (double) for my evaluation (scoring)
>>>function.  I set some variables to 0.0 when starting the Alpha-Beta search.
>>>I add values to these variables when a move is made and then subtract them
>>>back out when restoreing the piece.  I have found that the result is not
>>>always returned back to 0.0.  I get something like 3.56234567343534-18.
>>>
>>>Should I be using integers for scoring instead?
>>print out the answers with something along the lines of:
>>printf("%.2f", ce);
>>which will show 0.00 for the example you gave.  Subtraction is the most
>>catastrophic operation with floating point.  Using integers is not always
>>faster, and sometimes can cause other unsuspected problems (e.g. 1.999 = 1).
>
>Dan,
>
>Printing out the score is not my problem.  I am concerned because I have been
>using incremental bonuses and penaltys at each ply that the leaf evaluation
>node uses for its score.  I saw a score of more than 80 returned one time
>and my Queens are worth 9.  I know that more than 9 queens of material
>could not have been captured in the position.  I compared floating point
>verses integer at one time and it seemed that the floating point was
>slightly faster (on a Pentium 350).  I put the comparision for zero at
>the root ply to verify that incremental scores that were being added were
>also being backed out.  I can see that trivial values could (the catastrophic
>operation you mentioned) could grow larger when searching 10 to 12 nodes deep.
>
>Is there documentation somewhere that describes this effect of
>subtraction with floating point?
>
>Thanks for your reply!  :-}
David Goldberg: What Every Computer Scientist Should Know About Floating-Point
Arithmetic. Computing Surveys 23(1): 5-48 (1991)
I have a postscript subset of this paper if anyone wants a copy.  A must read,
IMO.  You can also get a copy here:
http://www.qtp.ufl.edu/common-tools/numerical_comp_guide/goldberg1.doc.html#

This is a good, quick, easy to understand summary:
http://sunsite.univie.ac.at/Fortran-Guide/ch4-9.html

"Mr. floating point: Dr. Kahan"
http://http.cs.berkeley.edu/~wkahan/




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.