June 17, 2024

Show decimal numbers with bc

scale defines the number of decimals.

By default, scale is 0 so no decimals are shown.

If you would like to show 2 decimals number, you can set scale to 2.

To do so, type:

scale = 2

before you type your computation.

For example:

$ bc
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006, 2008, 2012-2017 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'. 
scale = 2

Note: I need to figure how to set default to scale = 2

personal computing command-line interface (cli) gnu linux trisquel shell literacy office applications wiki bc offline

No affiliate links, no analytics, no tracking, no cookies. This work © 2016-2024 by yctct is licensed under CC BY-ND 4.0 .   about me   contact me   all entries & tags   FAQ   GPG public key

GPG fingerprint: 2E0F FB60 7FEF 11D0 FB45 4DDC E979 E52A 7036 7A88