Dividing with Gnu's bc
Posted
by
Boldewyn
on Super User
See other posts from Super User
or by Boldewyn
Published on 2009-12-18T11:03:21Z
Indexed on
2012/11/21
17:03 UTC
Read the original article
Hit count: 213
I'm just starting with Gnu's bc and I'm stuck at the very beginning (very discouraging...). I want to divide two numbers and get a float as result:
$bc
bc 1.06.94
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
15/12
1
15.0/12.0
1
15.000000/12.000000
1
scale(15.00000)
5
The man page says, that division returns a number with the same scale as the initial values. Obviously this is either not true or I'm missing something.
Googling hasn't brought up any new insights (besides that 'BC' can also stand for 'British Columbia').
Do you see my error? Better yet, do you know any good references/tutorials to bc?
© Super User or respective owner