Improve toNumber() and fromNumber()