• 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: "make positive" function
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "make positive" function


  • Subject: Re: "make positive" function
  • From: Mike Abdullah <email@hidden>
  • Date: Mon, 11 Sep 2006 20:21:55 +0100

Thanks for all the responses guys, I just didn't really know where to look. I guess for future reference, I really ought to look more at math.h and other such files.

Mike.

On 11 Sep 2006, at 20:02, Matt Neuburg wrote:

On Mon, 11 Sep 2006 19:28:29 +0100, Mike Abdullah <email@hidden>
said:
I'm not a C expert, so apologies for this one:

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?).

Anyway, it seems to me I have 3 options:

1. There is an existing, simple function in C - if so can someone
tell me what it is ? :)

2. Do the incredibly clunky, square variable, find square root

3. Write my own function.

It isn't a question of being a C expert. Use the headers, use the docs. Look
in math.h. If you don't know what the functions do, and you don't have K&R,
use Xcode's help. For example, search on "fabs". It contains links to the
rest of what you probably want to know. m.


--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>




_______________________________________________ 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
  • Follow-Ups:
    • Re: "make positive" function
      • From: Cameron Hayne <email@hidden>
References: 
 >Re: "make positive" function (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Newbie: Multiple instances of a NSWindow?
  • Next by Date: Re: Newbie: Multiple instances of a NSWindow?
  • Previous by thread: Re: "make positive" function
  • Next by thread: Re: "make positive" function
  • Index(es):
    • Date
    • Thread