Diff: BcNotes

Differences between current version and predecessor to the previous major change of BcNotes.

Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History

 Newer page: version 6 Last edited on Wednesday, June 20, 2007 11:40:40 am by BenStaz Older page: version 3 Last edited on Wednesday, February 14, 2007 7:02:39 pm by AlastairPorter Revert
@@ -1,12 +1,44 @@
Notes for the [bc(1)] arbitrary precision calculator
----

-!Handy Variables
+! !Handy Variables

-scale - scale defines how some operations use digits after the decimal point . (Default )
+! scale
+
+Defines how some operations use digits after the decimal point . (Default )
So if you type ''5/5'' ''bc'' interprets this as 5.00000/5.00000. and the answer is 1.00000

-last - is a variable that has the value of the last printed number.
+! 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.
+
+<verbatim>
+obase=10
+ibase=2
+101+111
+12
+</verbatim>
+
+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