Re: Clock-like looping
Re: Clock-like looping
- Subject: Re: Clock-like looping
- From: Jean-Daniel Dupas <email@hidden>
- Date: Sun, 29 Jun 2008 19:41:32 +0200
the '%' operator cannot be used with floating point values, but it
works well with integer:
=> (11 + 2) % 12 = 1
Le 29 juin 08 à 19:34, Daniel Richman a écrit :
Use
double newNumber = oldNumber % 13;
This will return your number's remainder when dividing between 13,
which could be 0 - 12.
Daniel
Ashley Perrien wrote:
Is there a fairly simple way of setting up a clock style looping of
numbers? Where 1-12 act normally but 11 + 2 would return 1 and so
on. I'm not doing time and would be dealing with ranges from 1 to
96, 77, 120, that type of range. Would also need to be able to
handle partial numbers (4.125 for instance). Any tips on where to
look or is it just a lot of manual checking to make sure the number
are within the correct range?
Ashley
_______________________________________________
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
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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