• 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: AppleScript bug with 15+ digits.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AppleScript bug with 15+ digits.


  • Subject: Re: AppleScript bug with 15+ digits.
  • From: Emmanuel <email@hidden>
  • Date: Fri, 4 Apr 2003 01:17:56 +0200

At 6:29 AM +0200 02/04/03, Philippe GRUCHET wrote:

Using Satimage osax (?), you could type:

format pi into "#.###############"
--> "3.141592653589793"

But it's always a string: is there a way to get it back as a number?
--> 3.141592653589793

Fairly easily, you just have to remove the extra digits
---------------------------------------
0 + (change "^[-+]*([\\.]{1}[0-9]+|[0-9]+[\\.]?[0-9]{0,12})([0-9]*)((e|E)[-+]*[0-9]+)*" into "\\1\\3" in s with regexp)
---------------------------------------
set s to "3.141592653589793 "
--> 3.141592653589
set s to "223333.1415926535897932332E-12"
--> 2.23333141592654E-7

In case the script did not make it safely thru the server, paste the following into Smile, select and press Cmd-Shift-G (you don't need to remove the CR's):
---------------------------------------
30202B20286368616E676520225E5B2D2B5D2A285B5C5C2E5D7B317D5B302D395D2B7C5B302D395D2B5B5C5C2E5D3F5B302D395D7B302C31327D29285B302D395D2A292828657C45295B2D2B5D2A5B302D395D2B292A2220696E746F20225C5C315C5C332220696E2073207769746820726567657870290D
---------------------------------------

(based on the "number, scientific notation" [only] preset Regular Expression of Smile's Enhanced Find Dialog)

Emmanuel
_______________________________________________
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: 
 >Re: AppleScript bug with 15+ digits. (From: Philippe GRUCHET <email@hidden>)

  • Prev by Date: RE: Path to reference (repost)
  • Next by Date: GUI Scripting in AS Studio
  • Previous by thread: Re: AppleScript bug with 15+ digits.
  • Next by thread: Re: AppleScript bug with 15+ digits.
  • Index(es):
    • Date
    • Thread