Re: Returning a nil float?
Re: Returning a nil float?
- Subject: Re: Returning a nil float?
- From: Chunk 1978 <email@hidden>
- Date: Sat, 30 Jan 2010 10:11:35 -0500
thanks. NAN seems to be the simplest solution.
On Fri, Jan 29, 2010 at 10:00 PM, Greg Guerin <email@hidden> wrote:
> Chunk 1978 wrote:
>
>> so above i'd like to write "if (!sound) return nil;". my reasoning is
>> because some attributes to a sound object (like pan) are created only
>> when the sound is initialized. if there is no sound object than there
>> should also be no pan value to return. unfortunately, the float
>> default 0.0f is also the default value for pan (range from -1.0 to
>> 1.0).
>
>
> You could return NaN to signify "no pan value".
>
> You should read up on the characteristics of NaNs, though. They don't
> compare equal to anything, even another NaN or itself. Using them in
> arithmetic also yields "interesting" results.
>
> man nanf
> man isnan
>
> http://en.wikipedia.org/wiki/NaN
>
> -- GG
>
> _______________________________________________
>
> 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