Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Currency Numbers



On 6/21/06 8:38 PM, "Paul Berkowitz" <email@hidden> wrote:

> here's an alternative to
> 
>     (y ^ 2) ^ 0.5
> 
> to get the absolute value of a number. Just for the hell of it. ;-)
> 
> 
>     (-((y < 0) as integer) * y) + (((y > 0) as integer) * y)


Here's a neater way to write that:

    y * (((y > 0) as integer) - ((y < 0) as integer))



-- 
Paul Berkowitz


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden

References: 
 >Re: Currency Numbers (From: Paul Berkowitz <email@hidden>)



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.