• 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: rounding to a multiple of x?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rounding to a multiple of x?


  • Subject: Re: rounding to a multiple of x?
  • From: Steve Bird <email@hidden>
  • Date: Wed, 19 May 2004 14:04:02 -0400

On May 19, 2004, at 11:47 AM, email@hidden wrote:

Greetings,

I can't seem to figure out how to roundup to a multiple of a number ie if i have 1149 and i want to round up to a multiple of 4 how would accomplish this? any direction would be great

1... integer divide by 4 (1149 / 4 = 287, remainder 1)
2.. To round UP to NEXT HIGHER multiple of four, add one (287 + 1 = 288) IFF remainder is not zero.
3... Multiply by 4 (288 * 4 = 1152)


----------------------------------------------------------------
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
www.Culverson.com (toll free) 1-877-676-8175
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >rounding to a multiple of x? (From: email@hidden)

  • Prev by Date: Lifetime of an NSURLHandle
  • Next by Date: Re: NSTableViewBindig inversing rows and columns ?
  • Previous by thread: Re: rounding to a multiple of x?
  • Next by thread: Re: rounding to a multiple of x?
  • Index(es):
    • Date
    • Thread