05-15-07 - 1

I made a big mistake in my poker bot code way way back in 2005 when I started it. I used "float" for the money amounts (the stacks, the pot size, etc.). They're decimal numbers right, use a float? I didn't really think about it and just went to work. Then float precision errors started popping up and I realized my mistake. Of course it's really an integer number of cents, so I should've used ints and worked in cents. Instead I just switched some floats to doubles where I was having trouble. But that doesn't really fix anything (doubles have plenty of precision but I still have failures because I store to disk in floats for size and backward compatibility). Now I've got the floats all over and it would be a huge mess to fix all because I didn't really think about it at the beginning.

No comments:

old rants