BASH question

Markku Kolkka markkuk at tuubi.net
Sun Sep 10 10:07:53 UTC 2006


Aaron Konstam kirjoitti viestissään (lähetysaika sunnuntai, 10. 
syyskuuta 2006 02:20):
> But if you know that bc and dc actually implement fixed point
> arithmetic routines ans can testify to that fact I will be
> interested to hear about it.

According to the POSIX definition of bc 
(http://www.opengroup.org/onlinepubs/009695399/utilities/bc.html), 
it should behave as if it uses fixed-point decimal arithmetic, 
no matter what the actual implementation: "Internal computations 
shall be conducted as if in decimal, regardless of the input and 
output bases, to the specified number of decimal digits."

The documentation for GNU bc 
(http://www.gnu.org/software/bc/manual/html_mono/bc.html#SEC5) 
states:
"Numbers are arbitrary precision numbers. This precision is both 
in the integer part and the fractional part. All numbers are 
represented internally in decimal and all computation is done in 
decimal." ... "There are two attributes of numbers, the length 
and the scale."
In other words, it uses fixed-point decimal arithmetic.

-- 
 Markku Kolkka
 markku.kolkka at iki.fi




More information about the users mailing list