Move some math calculations to Obj-C (really C macros) and force primiti...

...ve types for constants.
Why all this commented out code?