• 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
Simple multiplication going bizarre
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Simple multiplication going bizarre


  • Subject: Simple multiplication going bizarre
  • From: "Mark J. Reed" <email@hidden>
  • Date: Thu, 29 Apr 2010 13:20:30 -0400

Basically, the default stringification of numbers may not be what you
want.  When dealing with currency - and thus is a general truism with
applicability beyond AppleScript - you're better off using integers
representing the smallest denomination (pennies/pence/cents) and
converting to larger units for display only at the very end.

On Thursday, April 29, 2010,  <email@hidden> wrote:
> Hmmm, As Number doesn't work for me. Still get an exponent.
>
> On Apr 29, 2010, at 8:11am, Richard Lake wrote:
> Damn, yeah I should have used 'as number' ... I always have in the past I don't know why I choose not to on this occasion.  Thanks David, this works perfectly.
> On 29 Apr 2010, at 16:00, David Wolfe wrote:
> I can't even begin to understand what's going on here (math not a strong suit), but this works for me:
> set myVal to 4999.0 * 12.5 as numberdisplay dialog myVal
>
> David
>
> On Apr 29, 2010, at 10:44 AM, Luther Fuller wrote:
> On Apr 29, 2010, at 8:58 AM, Richard Lake wrote:4999.0*12.5 = 62487.5
> But applescript returns:
> 6.24875E+4
> ?????
> How do I get around this oddity?
> Here's one way ...
> set selfRef to (path to me)set x to (4999.0 * 12.5)tell application "Finder"  set comment of selfRef to x     set numText to (comment of selfRef)end telllog numText
> But, will this work for negative exponents? I haven't tried it, but I think not.
> You can use brute force with something like this ...
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
>


--
Mark J. Reed <email@hidden>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Simple multiplication going bizarre (From: Richard Lake <email@hidden>)
 >Re: Simple multiplication going bizarre (From: Luther Fuller <email@hidden>)
 >Re: Simple multiplication going bizarre (From: David Wolfe <email@hidden>)
 >Re: Simple multiplication going bizarre (From: Richard Lake <email@hidden>)
 >Re: Simple multiplication going bizarre (From: email@hidden)

  • Prev by Date: Re: Simple multiplication going bizarre
  • Next by Date: Re: Simple multiplication going bizarre
  • Previous by thread: Re: Simple multiplication going bizarre
  • Next by thread: Re: Simple multiplication going bizarre
  • Index(es):
    • Date
    • Thread