Gentoo Archives: gentoo-user

From: "Brett I. Holcomb" <brettholcomb@×××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Getting BC not to truncate at the decimal point?
Date: Thu, 25 May 2006 00:57:33
Message-Id: 200605242051.32646.brettholcomb@bellsouth.net
In Reply to: Re: [gentoo-user] Getting BC not to truncate at the decimal point? by Mike Huber
1 You're welcome. Don't feel bad - it took me a "This thing can't be that dumb"
2 and a man page read to find out it was smarter than I thought <G>.
3
4 On Wednesday May 24 2006 17:15, Mike Huber wrote:
5 > duh, sorry, case of me not fully reading the manpage. I'll be sure and
6 > fully read before I send to the list.
7 >
8 > Thanks a lot,
9 > --Mike
10 >
11 > On 5/24/06, brettholcomb@×××××××××.net <brettholcomb@×××××××××.net> wrote:
12 > > Did you try
13 > >
14 > > scale=n
15 > >
16 > > Where n is the number of digits after the decimal? More in man bc.
17 > >
18 > > > From: "Mike Huber" <michael.huber@×××××.com>
19 > > > Date: 2006/05/24 Wed PM 12:48:29 EDT
20 > > > To: gentoo-user@l.g.o
21 > > > Subject: [gentoo-user] Getting BC not to truncate at the decimal point?
22 > > >
23 > > > Hi,
24 > > > I'm just trying to do some quick calculations using bc, but the
25 > >
26 > > version
27 > >
28 > > > installed through portage truncates on multiplication/division. It
29 > >
30 > > didn't
31 > >
32 > > > used to do this 2 years ago when I was taking number theory, and there
33 > >
34 > > are
35 > >
36 > > > no USE flags available for sys-devel/bc to change this. From the
37 > >
38 > > manpage:
39 > > > ---------------------------------------------------------------------
40 > > >
41 > > > The most basic element in bc is the number. Numbers are arbitrary
42 > >
43 > > precision
44 > >
45 > > > numbers. This precision is both in the integer part and the
46 > >
47 > > fractional
48 > >
49 > > > part. All numbers are represented internally in decimal and all
50 > >
51 > > computation
52 > >
53 > > > is done in decimal. (This version truncates results from divide and
54 > > > multiply operations.) There are two attributes of numbers, the length
55 > >
56 > > and
57 > >
58 > > > the scale. The length is the total number of
59 > >
60 > > significant decimal digits
61 > >
62 > > > in a number and the scale is the total number of decimal digits after
63 > >
64 > > the
65 > >
66 > > > decimal point. For example:
67 > > > .000001 has a length of 6 and scale of 6.
68 > > > 1935.000 has a length of 7 and a scale of 3.
69 > > >
70 > > >
71 > > > -----------------------------------------------------------------------
72 > > >-
73 > > >
74 > > >
75 > > > Anyone have any ideas?
76 > > >
77 > > > --Mike
78 > >
79 > > --
80 > > gentoo-user@g.o mailing list
81
82 --
83
84 Brett I. Holcomb
85 --
86 gentoo-user@g.o mailing list