next up previous contents
Next: Calling functions Up: Introductory examples Previous: Introductory examples

Arithmetic

Add the rationals 1/2 and 1/6

LC Session

lc> 1/2 + 1/6;
$2 = 2/3
lc>

Note that the spaces between 1/2, + and 1/6 are not necessary, since operators are evaluated according to their priorities. In this case the operator / is evaluated (as you would expect) before the + operator.

The next example calculates pi to 40 decimal digits:

LC Session

lc> bigfloat::precision(40); PI;
$3 = 3.141592653589793238462643383279502884197
lc>



Thomas Papanikolaou
Thu Aug 28 10:25:48 MET DST 1997