• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Clock-like looping
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Clock-like looping


  • Subject: Re: Clock-like looping
  • From: Daniel Richman <email@hidden>
  • Date: Sun, 29 Jun 2008 10:34:32 -0700

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


  • Follow-Ups:
    • Re: Clock-like looping
      • From: Jean-Daniel Dupas <email@hidden>
    • Re: Clock-like looping
      • From: Daniel Richman <email@hidden>
References: 
 >Clock-like looping (From: Ashley Perrien <email@hidden>)

  • Prev by Date: Clock-like looping
  • Next by Date: Re: Clock-like looping
  • Previous by thread: Clock-like looping
  • Next by thread: Re: Clock-like looping
  • Index(es):
    • Date
    • Thread