Re: number with one decimal
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