matz / ruby-lang.org (Yukihiro Matsumoto) writes: > Hi, > > In message "dots in hex printf" > on 03/04/21, Ed L Cashin <ecashin / uga.edu> writes: > > |Hi. I was wondering why there are dots in printing out a hexadecimal > |number: > > You were trying to print negative numbers in hexadecimal. Ruby > assumes virtual infinite on-bits leftward for negative numbers. Dots > represents omitted bits on left side. If you don't want those dots, > specify format precision (e.g. "%.5x"), or bit-and with mask bits > (e.g. x & 0xffff). OK, thanks. I have always thought of printf as treating the argument associated with %x as unsigned (in which case I suppose there wouldn't be an infinite sign extension), but I can adjust. -- --Ed L Cashin PGP public key: http://noserose.net/e/pgp/