• 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: rounding integers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rounding integers


  • Subject: Re: rounding integers
  • From: Shane Stanley <email@hidden>
  • Date: Thu, 13 Nov 2003 11:47:50 +1100

On Nov 1, 2003, at 5:11 AM, Paul Berkowitz wrote:

You need OS 10.3 (AS 1.9.2) for '[real] as integer' coercion to work.

Picking up on an old thread...

I have a couple of scripts where I used the "as integer" coercion and a try construct to validate values, and of course some of these now fail. I'm trying to figure out the best approach to take.

In playing with things, I've noticed that you can coerce a value 67.5 to an integer, and a string like "67" to an integer, but you still can't coerce a string like "67.5" to an integer:

set x to 67.5
x as integer
set x to "67.5"
set x to x as number
x as integer
set x to "67.5"
x as integer --> Can't make "67.5" into a integer.

Because I'm often validating values that are entered as strings anyway, in a lot of cases I don't need to change anything. But the inconsistency troubles me, and I'm wondering whether in fact this is just an oversight/borderline bug that is likely to be "fixed" at some future date, and that I might as well change my approach now. Or is there likely to be some reason behind this difference in behavior?

--
Shane Stanley <email@hidden>
_______________________________________________
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.

  • Prev by Date: Re: Off: Disk Utility broken in 10.3.1 on G5s?
  • Next by Date: Re: Export Image From FileMaker
  • Previous by thread: Re: Off: Disk Utility broken in 10.3.1 on G5s?
  • Next by thread: FileVault
  • Index(es):
    • Date
    • Thread