• 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: newbie question: real with fraction to int
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: newbie question: real with fraction to int


  • Subject: Re: newbie question: real with fraction to int
  • From: Paul Berkowitz <email@hidden>
  • Date: Fri, 24 Oct 2003 09:58:19 -0700

On 10/24/03 8:39 AM, "leo" <email@hidden> wrote:

> i want to assign a real to an integer but casting or ("coerceing" in AS)
> works only for non fractional reals. so, the line
>
> set i to 9.5 as integer
>
> gives an error. how can i truncate a value to an int regardless of the
> fraction ? i looked thoroughly in the ASLanguageGuide but couldn't find
> anything.


1. round 9.5
--> 10

There are lots of options for rounding if you don't like the default (10):

[rounding up/down/toward zero/to nearest/as taught in school]

Check Standard Additions dictionary in Scripting Additions.


2. Wait until Panther arrives at your door. Then try your coercion again.

--
Paul Berkowitz

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >newbie question: real with fraction to int (From: leo <email@hidden>)

  • Prev by Date: Odd & Even Pages
  • Next by Date: Re: Odd & Even Pages
  • Previous by thread: Re: newbie question: real with fraction to int
  • Next by thread: Re: newbie question: real with fraction to int
  • Index(es):
    • Date
    • Thread