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
|