Issue #3 - fixed an edge case in a few math functions.