Re: Comparing NSDictionary woes
Re: Comparing NSDictionary woes
- Subject: Re: Comparing NSDictionary woes
- From: Rainer Brockerhoff <email@hidden>
- Date: Mon, 23 Jul 2007 09:40:12 -0300
At 22:47 -0700 22/07/2007, email@hidden wrote:
>From: Ken Tozier <email@hidden>
>References: <email@hidden>
> <email@hidden>
> <email@hidden>
> <email@hidden>
> <email@hidden>
> <email@hidden>
>In-Reply-To: <email@hidden>
>Date: Sun, 22 Jul 2007 20:33:25 -0400
>Message-ID: <email@hidden>
>
>The only thing I can think of is that NSString's propertyList method isn't unpacking "<real>2.5</real>" in a way that would yeild isEqual = YES for a real stored in an NSNumber like this [NSNumber numberWithDouble: 2.5]. Both dictionaries contain a lot of reals maybe that's the problem. All other values are ints and strings.
That would be the answer, comparing floats/doubles for equality is generally discouraged, particularly as numbers like "<real>0.1</real>" don't have exact representations and may be truncated or rounded invisibly somewhere in the process... and you're getting the dictionaries by widely different processes.
--
Rainer Brockerhoff <email@hidden>
Belo Horizonte, Brazil
"In the affairs of others even fools are wise
In their own business even sages err."
Weblog: http://www.brockerhoff.net/bb/viewtopic.php
_______________________________________________
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