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

Re: %#b format: bug?

Thread Previous | Thread Next
From:
Jarkko Hietaniemi
Date:
September 9, 1999 01:00
Subject:
Re: %#b format: bug?
Message ID:
14295.26810.738515.537263@alpha.hut.fi

Tom Christiansen writes:
 > 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

Fixed now for _62.

 > However, both 0X and 0x are legal numeric prefixes, but only 0b are,

Huh?  ./perl -e 'printf "%#b\n", 0X181'
Bareword found where operator expected at -e line 1, near "0X181"
        (Missing operator before X181?)
syntax error at -e line 1, next token ???

 > so perhaps I should be less surprised.
 > 
 > --tom

-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

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