You should not compare floating point numbers for equality in most cases. This 
is true of any language on any platform.

See 
http://www.cygnus-software.com/papers/comparingfloats/Comparing%20floating%20point%20numbers.htm

- Bryan

On Dec 10, 2009, at 10:02:23 PM, RedleX Support wrote:

> Hi,
> 
> I need to output a double into a text file and then read it back with 100% 
> accuracy, will using NSNumber stringValue and then using NSString doubleValue 
> give me good results?
> 
> For example, if I write the following:
> 
> double a,b;
> 
> a=some number;
> 
> b=[[[NSNumber numberWithDouble:a] stringValue] doubleValue];
> 
> will a==b
> 
> TIA
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/bryanhenry%40mac.com
> 
> This email sent to bryanhe...@mac.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to