Re: NSLog with %f and comparisons using ==
Re: NSLog with %f and comparisons using ==
- Subject: Re: NSLog with %f and comparisons using ==
- From: Michael Ash <email@hidden>
- Date: Sat, 11 Apr 2009 17:12:58 -0400
On Sat, Apr 11, 2009 at 4:45 PM, James Maxwell
<email@hidden> wrote:
> hmm... Well, this all sounds like a sledge-hammer approach to my immediate
> problem.
>
> The actual explanation of what I'm doing is kind of long-winded, so I'll
> spare you that. For now, I know the calculated values will always come out
> the same, since there are a limited number of possible inputs, and I know
> they'll very nearly match my stored constants (and my constants are well
> separated, so is more than enough).
Are you always running these calculations on identical hardware?
Because unless you're doing that, there's no way you can know that
your calculated values will always come out the same.
Floating point isn't just imprecise because the variables are of
finite size and therefore finite precision. It's also imprecise
because the individual calculations are not always performed to the
full precision available in the finite representation, and the
variation from full precision is pretty much implementation defined.
Mike
_______________________________________________
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