Hi folks - hopefully this is simple,
I'm writing some shell scripts to do some simple
math stuf for some of my users -
I'm using "dc" which is apparently an iteration
of "bc" . I need to set the scale (how many digits to the right of the decimal to display) when echoing a string
into the dc command ex: "echo 24.5 .5 * f | dc "
this command SHOULD give you an answer of 12.25 - dc is
truncating it to 12.2 or rounding it to 12.5.
if I feed it factors with the correct number of digits
ex: "echo 24.50 .5 * f| dc" then I get the desired output -
12.25 (dc having picked up from the input of 24.50 that I
want at least two digits on the ouput).
aaarrrrggghhhhh.
Chris
I'm writing some shell scripts to do some simple
math stuf for some of my users -
I'm using "dc" which is apparently an iteration
of "bc" . I need to set the scale (how many digits to the right of the decimal to display) when echoing a string
into the dc command ex: "echo 24.5 .5 * f | dc "
this command SHOULD give you an answer of 12.25 - dc is
truncating it to 12.2 or rounding it to 12.5.
if I feed it factors with the correct number of digits
ex: "echo 24.50 .5 * f| dc" then I get the desired output -
12.25 (dc having picked up from the input of 24.50 that I
want at least two digits on the ouput).
aaarrrrggghhhhh.
Chris