Re: rounding to a multiple of x?
Re: rounding to a multiple of x?
- Subject: Re: rounding to a multiple of x?
- From: Peter Borg <email@hidden>
- Date: Wed, 19 May 2004 19:28:16 +0200
This should work if you want to round it upwards:
unsigned int value = 1149;
unsigned int missing = value % 4;
if (missing) value = 4 - missing + value;
value should now be 1152.
Regards,
Peter
On 19 maj 2004, at 17.47, 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
_______________________________________________
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.
_______________________________________________
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.