Re: "make positive" function
Re: "make positive" function
- Subject: Re: "make positive" function
- From: Dado Colussi <email@hidden>
- Date: Mon, 11 Sep 2006 20:43:02 +0200
On Sep 11, 2006, at 20:28, Mike Abdullah wrote:
Basically, I want to take a double and get its closest positive
integer. I haven't been able to find anything that does what I
want (I have a feeling it might be a modulus?).
Would this do?
long int
closest_positive_integer(double x)
{
if (x < 1.0) {
return 1L; // Smallest positive integer
} else {
return lrint(x);
}
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden