I'm working on a program that does quite a bit of 3D math with planes, points, lines, etc. The most base class has 3 floats for x, y and z coordinates and I find I'm doing a fair bit of fudging and working around rounding issues with floats.
I was thinking of moving it over to either NSDecimal or NSDecimalNumber and am wondering 1) will this probably work around those issues and 2) aside from more complicated code, what are the drawbacks?
I'm assuming that NSDecimalNumber is slower and uses more memory than NSDecimal which is slower and uses more memory than a float but the final model I'm working with is probably only going to have around 4-600 points so I don't think speed or memory are going to be huge concerns. So that just leaves more complicated code. I'm okay with that if it does away with the "if (abs(a-b)<0.001)" and all the other massaging that needs to be done.
Advice? Suggestions?
I was thinking of moving it over to either NSDecimal or NSDecimalNumber and am wondering 1) will this probably work around those issues and 2) aside from more complicated code, what are the drawbacks?
I'm assuming that NSDecimalNumber is slower and uses more memory than NSDecimal which is slower and uses more memory than a float but the final model I'm working with is probably only going to have around 4-600 points so I don't think speed or memory are going to be huge concerns. So that just leaves more complicated code. I'm okay with that if it does away with the "if (abs(a-b)<0.001)" and all the other massaging that needs to be done.
Advice? Suggestions?