Date: Mon, 12 Nov 2007 05:01:31 -0800 (PST) From: Patrick Dung <patrick_dkt@yahoo.com.hk> To: freebsd-questions@freebsd.org Subject: question about floating point calcuation with shell script / bc Message-ID: <766805.50147.qm@web54304.mail.re2.yahoo.com>
next in thread | raw e-mail | index | archive | help
Hi I have a file with numbers in each line. Each number is a decimal number. My task is to add them up and get the final answer. I have searched with the search engine. I found bash cannot handle floating point calculation. I tried to use 'bc' and found if the final answer is < 1 (eg. 0.2) It display .2 instead of 0.2 (no leading zero). Any suggestion or other methods? I know ksh could do floating point calculation but I am now familiar with ksh. Regards Patrick __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?766805.50147.qm>