That is all true - but I think there are applications nowadays related to eval, where you may have huge simd wise SSE dot-products of feature vectors with (learned) 32-bit float or even 64-bit double weights, to implement tapered eval more smoothly with various sigmoid characteristics without to worry about overflows. Once per eval to convert a final double/float to a centipawn integer in a short range for comparison and alpha-beta backup is not critical at all.bob wrote:I'll add mine without worrying about duplication:oysteijo wrote:Hi,
I've started to browse a lot of computer chess code from several different engines. What puzzles me a bit is that "all" engines uses an evaluation function that returns an integer value.
From my ignorant point of view: Would it be more natural to return a floating point value?
Since the answer to the above question is probably "No", can someone explain "why not" ?
-Øystein
(1) speed. floating point is slower than integer.
(2) accuracy. You can't represent numbers like .1 .01, .001 exactly when converting to IEEE floating point. Just like we can't represent fractions like 1/3 exactly in decimal numbers.
(3) comparisons are a pain. == is a no-no in floating point operations because of the inaccuracy mentioned, and the existence of extra precision in the floating point stack that you can't store, so comparisons become problematic and most use a "fuzzy comparison". rather than if (a == b) we would use if (abs(a-b) < .000001) (use whatever precision you want.
4. All bits are significant so you can't just store the lower order N bits in a hash entry, you will have to reserve a full 32 or 64 bits.
5. null-window searches would be problematic in that "what is a null-window"? And before you start trying to play game with scoring increments so that you are sure that nobody changes the score by as little as .0001, go back to the accuracy point and re-read. This would be interesting as well
Integers avoid all of that, and have no down-side, so why would one want to use something that introduces quirks left and right and get nothing in return?
Anyway, out of interest related to the null-window issue, I am interested how to calculate the smallest possible increment 'I' of an IEEE 754-1985 64-bit double or 32-bit float F, so that
Code: Select all
F + I > F