On Sun, 10 Oct 2004 13:48, Nick Rout wrote:
> On Sun, 2004-10-10 at 13:21, Christopher Sawtell wrote:
> > On Sun, 10 Oct 2004 12:59, Ross Drummond wrote:
> > > I am in the middle of some script wrangling.
> > >
> > > I am having difficulty making bc work how I want.
> > >
> > > [EMAIL PROTECTED] user]$ echo "scale=0; 2*2.3" |bc
> > >
> > > returns 4.6. I want it to return an integer.
> > >
> > > How do I make bc do this?
> >
> > echo "scale=0; (2*2.3)/1"
>
> thats weird
>
> when i start up bc, scale is set to 0
> 1/3 gives answer 0 (expected)
> 2*2.3 gives 4.6 (not expected)
> 2*2.3/1 gives 4 (expectation indeterminate given the line above)
>
>
> is this a bug or something I am not grokking?
According to the bc man page, the scale thing doesn't work on all functions,
but as it the nature of man pages it doesn't say which ones.
Experimentation shows it works for divide, so dividing the result by one, when 
scale=0, has the effect of removing the decimal places.

-- 
Sincerely etc.,
Christopher Sawtell

Reply via email to