[MacRuby-devel] NSNumber 32 bit arch???

Louis-Philippe default at spiralix.org
Fri Jun 11 16:16:00 PDT 2010


Hi folks,

Maybe I don't get the way NSNumber works... but how can these number be:

arch -arch i386 macirb --simple-prompt
>> 0x44485250
            # reality check
=> 1145590352
>> NSNumber.numberWithInt(0x44485250)                              # then
see all 32 NSNumber are weird...
=> 71848528
>> NSNumber.numberWithFloat(0x44485250)
=> 1145590272.0
>> NSNumber.numberWithInt(1145590352)
=> 71848528
>> NSNumber.numberWithFloat(1145590352)
=> 1145590272.0
>> n = NSNumber.numberWithFloat(1145590352.0)
=> 1145590272.0
>> n.floatValue
=> 1145590272.0

versus:

arch -arch x86_64 macirb --simple-prompt
>> 0x44485250
          # reality check
=> 1145590352
>> NSNumber.numberWithInt(0x44485250)
=> 1145590352
>> NSNumber.numberWithFloat(0x44485250)
=> 1145590400.0
>> NSNumber.numberWithInt(1145590352)
=> 1145590352
>> NSNumber.numberWithFloat(1145590352)
=> 1145590400.0
>> NSNumber.numberWithFloat(1145590352.0)                      # this is
weird again...
=> 1145590400.0
>> n = NSNumber.numberWithFloat(1145590352.0)
=> 1145590400.0
>> n.floatValue
=> 1145590400.0

?????
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20100611/7fcf9ac8/attachment.html>


More information about the MacRuby-devel mailing list