Hi,

That works, but it's not exactly what I wanted. I want to round a
decimal and print it, not convert it to string, shorten it and then
print it.

[EMAIL PROTECTED] wrote:
> 
> Hello, Michal:
> 
> On 24-Jan-00, [EMAIL PROTECTED] wrote:
> 
> > Is it possible to print decimal values with a given precision, or to
> > round them?
> 
> > For example, print 3.14159265358979 as 3.14
> 
> > I haven't found it anywhere in the docs.
> 
> You need PARSE/SERIES/COPY/PART in the latest manual, but I didn't see an
> example there with a string count length...
> 

That works for strings, not decimals.

> The following gives an error, but it shouldn't IMHO. What's the point of
> having "pi" if it won't substitue for the decimal number?
> 
>  new-string: COPY/PART pi 4
>  PRINT new-string
> 
> ** Script Error: COPY expected value argument of type: series port bitset.
> 

pi is decimal, not string:

>> copy/part to-string pi 4
== "3.14"

> ...so use...
> 
> >> new-string: COPY/PART "3.14159265358979" 4
> == "3.14"
> 
> It worked!
> 

It worked just by coincidence, it won't round 3.228 correctly.

>> copy/part to-string 3.228 4
== "3.22"

> --
> 
>                 ---===///||| Donald Dalley |||\\\===---
>                      The World of AmiBroker Support
>                   http://webhome.idirect.com/~ddalley
>                    Member: ICOA and Team AMIGA

-- 
Michal Kracik

Reply via email to