• 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: number with one decimal
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: number with one decimal


  • Subject: Re: number with one decimal
  • From: "Mark J. Reed" <email@hidden>
  • Date: Mon, 18 Jul 2011 18:16:29 -0400

Any computer software using floating-point arithmetic shares
AppleScript's opinion on that.  This is a rounding problem, but if all
you care about is the output, just fake the division when you do the
string conversion yourself.  Assuming scale is an integer:

(text 1 through -2 of (scale as text)) & "." & (text end of (scale as text))


On Monday, July 18, 2011, Steve Thompson <email@hidden> wrote:
>
> On 18 Jul 2011, at 20:26, Willem wrote:
> It does not work to round things.
> As i said, i am stuck
> This is how I get round this problem edited to use your variable names:
> set resultaat to 82set theCommand to "echo " & quote & "scale=1;" & resultaat & "/10" & quote & "| bc"set Resultaatveld to do shell script theCommand
> 	do shell script "echo \"scale=1;82/10\"| bc"		--> "8.2"
> The scale command controls the number of decimal places.
> Steve
> _________________________
>
> Steve Thompsonhttp://about.me/stetho
>
>
>
>
>

--
Mark J. Reed <email@hidden>
 _______________________________________________
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

  • Follow-Ups:
    • Re: number with one decimal
      • From: Steve Thompson <email@hidden>
References: 
 >number with one decimal (From: Willem <email@hidden>)
 >Re: number with one decimal (From: Steve Thompson <email@hidden>)

  • Prev by Date: Re: number with one decimal
  • Next by Date: Re: number with one decimal
  • Previous by thread: Re: number with one decimal
  • Next by thread: Re: number with one decimal
  • Index(es):
    • Date
    • Thread