Bring over the actual code from gjtorikian/mathematical

This should bring over all the C code and the Ruby tests into this project.