From: Koji Arai Date: 2001-05-20T01:01:13+09:00 Subject: [ruby-talk:15399] Re: ruby bugs Hi. In message "[ruby-talk:15378] ruby bugs" on 19 May 2001 04:45:58 +0900, Mathieu Bouchard wrote: > > Bug report. > > > The expression: > > printf "%x", -42 > > shows: > > ..fd6 > > I assert that it should show: > > -2a > > that is, the same as: > > printf "%s%x", (-42<0) ? "-" : "", (-42).abs you can specify singed flag: p sprintf("% x", 42) # => " 2a" p sprintf("% x", -42) # => "-2a" p sprintf("%+x", 42) # => "+2a" p sprintf("%+x", -42) # => "-2a" -- Koji Arai