Reuse code in isXNumber() to avoid duplication and unneeded computations
Merge pull request #455 from Dmitry-Me/refactorNumberIsX

Reuse code in isXNumber() to avoid duplication and unneeded computations