partial refactor w/ sign / decimal support. edge cases not 100% examined.
refactor / memory function might have bugs