Fix unreferenced Math.sign method in older Chrome, Safari and more

I was trying to use this last night, but it errored out saying Math.sign wasn't defined in my version of Chrome. I also noticed you had a bug report about it not working in Safari, and guessed that it was related. This just adds Math.sign if it's not defined. Fixes the issue for me in Chrome and Safari.