Gentoo Archives: gentoo-user

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

Replies

Subject Author
Re: [gentoo-user] Getting BC not to truncate at the decimal point? "Brett I. Holcomb" <brettholcomb@×××××××××.net>