added some C code and fixed a little name in haskell math