• 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: String to real conversion question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: String to real conversion question


  • Subject: Re: String to real conversion question
  • From: Yvan KOENIG <email@hidden>
  • Date: Sun, 2 May 2010 18:46:24 +0200


Le 2 mai 2010 à 17:59, Bob Studer a écrit :

On May 2, 2010, at 8:30 AM, Mark J. Reed wrote:

I can't reproduce this behavior.  I get  z=1.0 every time.

On Sun, May 2, 2010 at 11:19 AM, Bert Groeneveld <email@hidden> wrote:
-- value x and y are always strings (please assume they are always coercable to real).

set x to "0.25" -- string
--set x to x as number -- z still outputs 100
--set x to x as real -- z still outputs 100
set y to "4" -- string
set z to x * y -- how can I output z = 1 here, instead of z = 100?

—

Bert.

I would hazard a guess that this has to do with how the string is interpreted because the original poster is from the Netherlands (at least his TLD indicates so) and so probably has the locale set for there. He could try using "0,25"

It's curious.

On my French system

set x to "0.25"
x as number

returns the logical error message :

"Il est impossible de rendre \".25\" en type number." number -1700 from ".25" to number

Seems that the bug strikes on systems using the decimal period,
not on systems using the decimal comma.

Yvan KOENIG (VALLAURIS, France) dimanche 2 mai 2010 18:46:17


 _______________________________________________
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: 
 >String to real conversion question (From: Bert Groeneveld <email@hidden>)
 >Re: String to real conversion question (From: "Mark J. Reed" <email@hidden>)
 >Re: String to real conversion question (From: Bob Studer <email@hidden>)

  • Prev by Date: Re: String to real conversion question
  • Next by Date: Re: String to real conversion question
  • Previous by thread: Re: String to real conversion question
  • Next by thread: Re: String to real conversion question
  • Index(es):
    • Date
    • Thread