Gentoo Archives: gentoo-user

From: brettholcomb@×××××××××.net
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Getting BC not to truncate at the decimal point?
Date: Wed, 24 May 2006 20:57:53
Message-Id: 20060524204625.WNLR4103.ibm67aec.bellsouth.net@mail.bellsouth.net
1 Did you try
2
3 scale=n
4
5 Where n is the number of digits after the decimal? More in man bc.
6
7 >
8 > From: "Mike Huber" <michael.huber@×××××.com>
9 > Date: 2006/05/24 Wed PM 12:48:29 EDT
10 > To: gentoo-user@l.g.o
11 > Subject: [gentoo-user] Getting BC not to truncate at the decimal point?
12 >
13 > Hi,
14 > I'm just trying to do some quick calculations using bc, but the version
15 > installed through portage truncates on multiplication/division. It didn't
16 > used to do this 2 years ago when I was taking number theory, and there are
17 > no USE flags available for sys-devel/bc to change this. From the manpage:
18 >
19 > ---------------------------------------------------------------------
20 >
21 > The most basic element in bc is the number. Numbers are arbitrary precision
22 > numbers. This precision is both in the integer part and the fractional
23 > part. All numbers are represented internally in decimal and all computation
24 > is done in decimal. (This version truncates results from divide and
25 > multiply operations.) There are two attributes of numbers, the length and
26 > the scale. The length is the total number of significant decimal digits
27 > in a number and the scale is the total number of decimal digits after the
28 > decimal point. For example:
29 > .000001 has a length of 6 and scale of 6.
30 > 1935.000 has a length of 7 and a scale of 3.
31 >
32 >
33 > ------------------------------------------------------------------------
34 >
35 >
36 > Anyone have any ideas?
37 >
38 > --Mike
39 >
40 >
41
42 --
43 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] Getting BC not to truncate at the decimal point? Mike Huber <michael.huber@×××××.com>