learnpython.org - an online interactive Python tutorial
harrismh777
harrismh777 at charter.net
Sun Apr 24 04:39:05 CEST 2011
Cameron Simpson wrote:
> | folks are not aware that 'bc' also has arbitrary precision floating
> | point math and a standard math library.
>
> Floating point math? I thought, historically at least, that bc is built
> on dc (arbitrary precision integer math, reverse polish syntax) and that
> consequently bc uses fixed point math rather than floating point.
My bad... I don't mean under-the-covers... I mean that the user may
calculate arbitrary precision floating arithmetic ... bc keeps track of
the decimal point and displays the number of digits the user specifies;
arbitrary precision calculator. (loose language, sorry)
On a *nix system, Mac OSx, Linux, run this to get 1000+ digits of PI:
time echo "scale = 1010; 16 * a(1/5) - 4 * a(1/239)" |bc -lq
scale sets the precision, -lq loads the math library arctan() quiet.
More information about the Python-list
mailing list