develooper Front page | perl.perl5.porters | Postings from September 1999

%#b format: bug?

Thread Previous | Thread Next
From:
Tom Christiansen
Date:
September 8, 1999 17:48
Subject:
%#b format: bug?
Message ID:
199909090047.SAA21964@jhereg.perl.com
Watch this:

    printf "%#o\n", 181
    0265

    printf "%#x\n", 181
    0xb5

But 

    printf "%#b\n", 181
    010110101

I should have expected 

    0b10110101

for that one.  And given this:

    printf "%#X\n", 181
    0XB5

This surprises me:

    printf "%#B\n", 181
    %#B

However, both 0X and 0x are legal numeric prefixes, but only 0b are,
so perhaps I should be less surprised.

--tom

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About