Notes for the bc(1) arbitrary precision calculator

### Handy Variables

#### scale

Defines how some operations use digits after the decimal point . (Default 0)
So if you type *5/5* *bc* interprets this as 5.00000/5.00000. and the answer is 1.00000

#### last

A variable that has the value of the last printed number.
So if you have a running total in *bc* of 100, then last+10 would result in 110.

#### ibase

Define the conversion base for input numbers.

#### obase

Define the conversion base for output numbers.

### Common Operations

#### Input numbers with a particular base but output them in a different base.

Say we want to add the binary numbers 101 and 111 but output the result in decimal.

obase=10
ibase=2
101+111
12

Note : Keep in mind if you set the ibase to a particular number, all variable values you set will need to be in that base.

For example : Say we have ibase=2 and obase=10. To change ibase to 10 (decimal) then we would do : *ibase=1010*

CategoryNotes