• 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: integers which just won't be round
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re: integers which just won't be round


  • Subject: re: integers which just won't be round
  • From: Charles Arthur <email@hidden>
  • Date: Mon, 29 Apr 2002 16:28:29 +0100

On Sun, 28 Apr 2002 11:30:15 +0100, under another topic line, Nigel Garvey
<email@hidden> wrote:
> set aardvark to (1234.56 + 7248.83)
>
> realToString(aardvark)
> --> "8483.389999999999"
>
>The best fix for your version at the moment would seem to be:
>
> on realToString(theReal)
> set oldTIDs to applescript's text item delimiters
> set applescript's text item delimiters to {""}
> set str to numToStr(theReal)
> set applescript's text item delimiters to oldTIDs
> return str
> end realToString
>
> realToString(aardvark)
> --> "8483.39"

Could someone explain why this happens, and what the easy cure is? I'm
doing something at the moment where I create columns in Applescript Studio.
I do a sum on some numbers (turn them into integers and then divide by 10
to get 1 dec place).

Run in SE, the numbers come up as expected, with 1 dp.
Run in AStudio, I get stuff like 80.09999999999.

Why? More importantly, how not?

Charles

----------------------------
http://www.ukclimbing.com : 1100+ British crags, 350+ British climbing
walls - searchable by distance and anything else you care to think of -
with weather forecasts for every one, plus maps, articles, news and
features. And there's even a cool shop attached.



________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________
_______________________________________________
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.

  • Follow-Ups:
    • re: integers which just won't be round
      • From: John W Baxter <email@hidden>
    • re: integers which just won't be round
      • From: Emmanuel <email@hidden>
  • Prev by Date: Re: Setting Script variables with Apple Events
  • Next by Date: List Folder and OS X Finder Concerns
  • Previous by thread: RE: Scripting "Print Center" in X
  • Next by thread: re: integers which just won't be round
  • Index(es):
    • Date
    • Thread