Document CMath

Don't merge it now, I'll document more functions tomorrow. Just needed some review.
This explanation does not seem to correspond to the implementation below.