View Single Post
Old 07-04-2012, 12:36 PM   #46
dentin
Member
 
Join Date: Apr 2008
Home MUD: Alter Aeon
Posts: 245
dentin is on a distinguished road
Re: Can MUDs implement range/distance?

Camlorn: KaVir is way ahead of you here. I believe his point was that if you use integer math and have big distance differences (greater than above 46000 units), you can end up passing in a negative number to the square root function due to integer overflow. These kinds of integer overflow problems are a really common problem in signal processing, and I've seen it a ton over the last ten or so years. Integer overflow makes up a significant fraction of C programming code bugs.

FYI, when KaVir says something I don't understand, I've found it to be good policy to assume I've missed something important. His track record on posts like this is extremely good. He wouldn't write up a complicated function to calculate distance if he didn't have a good reason for it.

-dentin

Alter Aeon MUD
dentin is offline   Reply With Quote