discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wrong Description from NSNumber


From: Gerrit Van Dyk
Subject: Re: Wrong Description from NSNumber
Date: Mon, 12 Nov 2001 14:15:42 +0200

>I have finished porting our backend system to gnustep. Our system makes use
>of NSNumber's description method quite a lot. I am sorry to say but this
>returns total garbage from an implementation point of view. If I construct
a
>number from a float ie [NSNumber numberWithFloat:1.5] the description
method
>returns "0.0000000" which is definitely not 1.5. If I construct a number
>from a short ie [NSNumber numberWithShort:25] the description method
returns
>"-1073807335". 

After futher investigation I found that numberWithFloat: does indeed work
correctly, I initially did this in gdb and it seems that something went
wrong there. The numberWithShort: does give wrong results.

I did the following:

str = [NSString stringWithFormat:@"%hd",25];
printf("%s",[str cString]);

This yielded:
-1073807335

printf("%hd",25); yielded:
25

The %hd i took from the NSNumber descriptionWithLocale: method.

Where can I find futher information on this, I am temporarily changing the
formatting in NSNumber to be %d instead of %hd.

Regards
Gerrit van Dyk
 
-------------------------------------------------------------------------
This e-mail is intended only for the use of the individual or entity named
above and may contain information that is confidential and privileged,
proprietary to the company and protected by law. If you are not the intended
recipient, you are hereby notified that any dissemination, distribution or
copying of this e-mail is strictly prohibited. Opinions, conclusions and
other information in this message that do not relate to the official
business of our company shall be understood as neither given nor endorsed by
it.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]