bc

Section: Misc. Reference Manual Pages (pj)
Updated: 3 July 2005
Index Return to Main Contents
 

NAME

bc Tips  

DESCRIPTION

To change the number of decimal places you see, do this:

scale=5

ibase and obase determine the "input base" and the "output base," so you can use them to do conversions. See them like this:

obase
10
ibase
10

Set them like this:

ibase=2
ibase
2
ibase=1010
ibase
10
obase=8
obase
10

Why does obase say 10, when it should be 8? Well, because you set the output base to 8, and 10 octal is 8 decimal. Crazy, huh? I suppose displaying the value of obase always yields 10.

So pretend you want to convert from octal to binary. Do this:

obase=2
ibase=8
357
11101111

 

AUTHOR

Paul Jungwirth  

COPYRIGHT

Copyright © 2005 Paul Jungwirth


 

Index

NAME
DESCRIPTION
AUTHOR
COPYRIGHT

This document was created by man2html, using the manual pages.
Time: 17:54:00 GMT, November 10, 2017