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

Re: Re: "make positive" function


  • Subject: Re: Re: "make positive" function
  • From: "Shawn Erickson" <email@hidden>
  • Date: Mon, 11 Sep 2006 11:48:38 -0700

On 9/11/06, John Stiles <email@hidden> wrote:
#include <math.h>

void myFn()
{
        //...
        double positiveValue = floor( abs(value) + 0.5f );
}

Likely meant fabs(value) in the above and not fully understanding what the OP wants... use of round may be more correct (not clear if he wants the closest greater than integer or just the closest integer).

Also not clear if he wants an integer (int) at the end of this or
not... which he can get from casting of course.

-Shawn
_______________________________________________
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: John Stiles <email@hidden>
References: 
 >"make positive" function (From: Mike Abdullah <email@hidden>)
 >Re: "make positive" function (From: John Stiles <email@hidden>)

  • Prev by Date: NSEditorRegistration - editor argument?
  • Next by Date: Re: Re: clicking through
  • Previous by thread: Re: "make positive" function
  • Next by thread: Re: "make positive" function
  • Index(es):
    • Date
    • Thread