I see you use float.MaxValue to get the max distance; I was wondering if there is any drawbacks to using float’s special values of float.PositiveInfinity in place of using float.MaxValue?
I don’t think there is. Perhaps a few milliseconds in processing because float.PositiveInfinity
is not actually a number and needs to be processed a little different, but I could be wrong.
Hmm I’ve never used float.PositiveInfinity, it appears to be what you get if you add something onto float.MaxValue
Both are essentially “infinite” so I don’t think there’s any difference.
The only time I have seen it used is as a result of dividing a float (or double) by float zero; since they are floating points(excluding Decimal since it does not use special values) it will not give an error; instead it will result in positive or negative infinity (depending on the signs of the nominator or denominator because zero can be positive or negative.) But, since I am not really sure what it will do when used to calculate max distance it would probably be safer to go with your approach instead.
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.