refactor + more fixes + input type checking and conversion

It's https://github.com/sutoiku/formula.js/pull/26 plus the proper type checking and conversion for all formulas and some more fixes.