On 24/05/06, Harald Arnesen <[EMAIL PROTECTED]> wrote:
"Mike Huber" <[EMAIL PROTECTED]> writes:

> Hi,
>   I'm just trying to do some quick calculations using bc, but the version
> installed through portage truncates on multiplication/division.  It didn't
> used to do this 2 years ago when I was taking number theory, and there are
> no USE flags available for sys-devel/bc to change this.  From the manpage:

$ bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
101/3
33

$ bc -l
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
101/3
33.66666666666666666666
--
Hilsen Harald.

--
gentoo-user@gentoo.org mailing list



Hi,

I have always understood bc has always truncated (or at least through
my general usage) whenever I have needed it to grow the decimal
precision I use the scale= option:

$ echo "101/3" | bc
33
$ echo "scale=10; 101/3" | bc
33.6666666666
$ echo "scale=3; 101/3" | bc
33.666
$ echo "101/3" | bc -l
33.66666666666666666666

-l auto sets the scale to 20 (as per manpage).  Same version of bc.

Thanks
Mark

--
gentoo-user@gentoo.org mailing list

Reply via email to