Re: NaN Problem Adding Numbers from NSTableView
Re: NaN Problem Adding Numbers from NSTableView
- Subject: Re: NaN Problem Adding Numbers from NSTableView
- From: Keary Suska <email@hidden>
- Date: Thu, 22 Apr 2010 10:29:15 -0600
On Apr 22, 2010, at 9:06 AM, Graham Cox wrote:
>
> On 23/04/2010, at 12:47 AM, Keary Suska wrote:
>
>> I wouldn't think that the formatter would effect the calculation of a key path operator, which is the OP's main issue as I understand--@sum is choking on NaN...
>
>
> Yep, I was thinking that by setting the NaN symbol it would prevent the cell from putting out a NaN value, but of course it works the other way around. It's odd though, surely any non-parsable string in the cell returns 0 for -stringValue? It could still be an effect of the formatter - it might be converting strings to NaN by some internal logic of its own. If so, a subclass that converts in another fashion would be the way to do it.
I suspect that the array controller is returning NaN for a nil value, and IIRC NaN + anything is NaN, which I think is the OP's problem.
I don't think the OP can avoid interpreting nil as 0. Implementing a special-case pseudo-accessor that returns 0 for nil for use in such calculations may not be too atrocious a solution, and would still allow for blank cells in the UI.
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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