• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSNumber stringValue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSNumber stringValue


  • Subject: Re: NSNumber stringValue
  • From: Bryan Henry <email@hidden>
  • Date: Sat, 12 Dec 2009 00:14:29 -0500

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 floating point numbers.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 (email@hidden)
>
> 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:
>
> This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSNumber stringValue
      • From: Andrew Farmer <email@hidden>
References: 
 >NSNumber stringValue (From: RedleX Support <email@hidden>)

  • Prev by Date: [COCOA] notification of enter/focus event?
  • Next by Date: Re: Hang Initializing App
  • Previous by thread: NSNumber stringValue
  • Next by thread: Re: NSNumber stringValue
  • Index(es):
    • Date
    • Thread