For the bit tweakers

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

kiroje

For the bit tweakers

Post by kiroje »

Just saw this and wanted to share it, nice bit of history and trick in getting the inverse aquareroot

code
http://www.codemaestro.com/reviews/9

history
http://www.beyond3d.com/content/articles/8/
Dann Corbit
Posts: 12541
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: For the bit tweakers

Post by Dann Corbit »

http://www.jjj.de/fxt/fxtpage.html#fxtbook
Look at "Algorithms for Programmers"
Steelman

Re: For the bit tweakers

Post by Steelman »

Dann Corbit wrote:http://www.jjj.de/fxt/fxtpage.html#fxtbook
Look at "Algorithms for Programmers"
No application for chess engines?
Dann Corbit
Posts: 12541
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: For the bit tweakers

Post by Dann Corbit »

Steelman wrote:
Dann Corbit wrote:http://www.jjj.de/fxt/fxtpage.html#fxtbook
Look at "Algorithms for Programmers"
No application for chess engines?
Are you kidding? It's crammed with stuff that will be useful for chess programs.

There are loads of bit twiddling algorithms, there are debruijn algorithm explanations and demonstrations.

Much of it is aimed at extended precision calculations, but there is plenty of other interesting stuff in there.
User avatar
cms271828
Posts: 316
Joined: Wed Apr 12, 2006 10:47 pm

Re: For the bit tweakers

Post by cms271828 »

Interesting, but when would you use an inverse square root in a chess engine, I don't think I use them in mine.
Colin
User avatar
WinPooh
Posts: 267
Joined: Fri Mar 17, 2006 8:01 am
Location: Russia
Full name: Vladimir Medvedev

Re: For the bit tweakers

Post by WinPooh »

cms271828 wrote:Interesting, but when would you use an inverse square root in a chess engine, I don't think I use them in mine.
But maybe proper use of an inverse square root is the main secret of Rybka's strength? :D
Gerd Isenberg
Posts: 2250
Joined: Wed Mar 08, 2006 8:47 pm
Location: Hattingen, Germany

Re: For the bit tweakers

Post by Gerd Isenberg »

WinPooh wrote:
cms271828 wrote:Interesting, but when would you use an inverse square root in a chess engine, I don't think I use them in mine.
But maybe proper use of an inverse square root is the main secret of Rybka's strength? :D
You mean the fast sigmoid bending of eval terms on the game phase via RSQRTPS? ;-)
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: For the bit tweakers

Post by mcostalba »

Gerd Isenberg wrote:
WinPooh wrote:
cms271828 wrote:Interesting, but when would you use an inverse square root in a chess engine, I don't think I use them in mine.
But maybe proper use of an inverse square root is the main secret of Rybka's strength? :D
You mean the fast sigmoid bending of eval terms on the game phase via RSQRTPS? ;-)
.

Nice to know this sigmoid implementation. I come up with a linearized one few weeks ago

http://64.68.157.89/forum/viewtopic.php?t=23860

But I didn't know this argument has been already investigated before.
Dirt
Posts: 2851
Joined: Wed Mar 08, 2006 10:01 pm
Location: Irvine, CA, USA

Re: For the bit tweakers

Post by Dirt »

kiroje wrote:...inverse aquareroot..
Inverse square root is easy and usually just takes one or two instructions. Just multiply the number by itself.

This all seems to be about calculating a reciprocal square root.
Dann Corbit
Posts: 12541
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: For the bit tweakers

Post by Dann Corbit »

cms271828 wrote:Interesting, but when would you use an inverse square root in a chess engine, I don't think I use them in mine.
Distance to mate?
G,D,R
;-)