Testing Base & Number Related Things in PHP
Alan Hogan’s project for CSE 230 at ASU
Output
sprintf("%d", "1111101") >> 1111101
twoscomp("1111101") >> 0000011
twoscomp(twoscomp("1111101")) >> 1111101
bindec("1111101") >> 125
smartbindec("1111101") >> -3
decbin(smartbindec("1111101")) >> 1111111111111111111111111111111111111111111111111111111111111101
sprintf("%032b",smartbindec("1111101")) >> 1111111111111111111111111111111111111111111111111111111111111101
sprintf("%b",smartbindec("1111101")) >> 1111111111111111111111111111111111111111111111111111111111111101