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

Re: Simple multiplication going bizarre


  • Subject: Re: Simple multiplication going bizarre
  • From: Thomas Fischer <email@hidden>
  • Date: Fri, 30 Apr 2010 15:08:38 +0200

Hi,

as far as I know there is really no coercion to "number", number is a vital superclass to integer and float, so if you don't want float (which comes with exponents) you have to take integers. (This has been changed in the past, earlier version of Applescript may behave differently.)
If you know, how many digits you need, you can proceed as follows:

set myVal to 4999.0 * 12.5
set myVal to myVal * 100 as integer
set myFraction to myVal mod 100
set myVal to myVal div 100
set myVal to myVal & "." & myFraction as text
display dialog myVal

Cheers
Thomas

Thanks
 
Richard Lake
Marketing Manager

Tel:
 0800 158 3898 | Email: email@hidden
smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

  • Follow-Ups:
    • Re: Simple multiplication going bizarre
      • From: Yvan KOENIG <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>)

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