| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
On 4 Dec 2004, at 20:56, Gregory Weston wrote:
The difference is probably that fabs has well defined behaviour in case one (or both) of x and y is something like NaN or +/- \infty, whereas this might not be the case for the expression you give.On Dec 4, 2004, at 2:18 PM, Malte wrote:
i've been looking around trying to find a method that calculates the |absolute value| of a number. Without success. Does anyone know if such a function exists?
They do, but you're probably better off just writing
T abs = ((x<y) ? (y-x) : (x-y));
where T is whatever type you need the result to be.
Fred
_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden
| References: | |
| >Re: Absolute Value |x - y| (From: Gregory Weston <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.