Skip to Content.
Sympa Menu

baslinux - Re: [BL] dc

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: Lee Forrest <lforrestster AT gmail.com>
  • To: BasicLinux List <baslinux AT lists.ibiblio.org>
  • Subject: Re: [BL] dc
  • Date: Wed, 7 Feb 2007 15:57:48 +0000

On Thu, Feb 08, 2007 at 08:58:10AM +1300, 3aoo-cvfd AT dea.spamcon.org wrote:
> Following on from our recent discussion of dc
> (the CLI calculator in BL3), I have discovered
> something new about it. It can do base 16 math.
>
> base 10 math
> ------------
> dc 8 4 + p = 12
> ------------
>
> base 16 math
> ---------------
> dc 16 o 8 4 + p = c
> ---------------

Hexadecimal! That's pretty neat. I'll put that in my man page.
The syntax required by dc is pretty different, so I worked out some
examples and put those in my man page:

dc 4 8 + 4 4 + + p
20
dc 4 8 4 4 + + + p
20
dc 4 8 + 2 / p
6
dc 2 2 + 2 2 + 2 2 + + + p
12
dc 2 2 2 2 + + + p
8
dc 2 2 2 + + p
6
dc 2 2 2 + + 3 / p
2
dc 8 8 \* 2 2 + / p
16

If it wasn't for the examples given by 'dc -help' I'd have been
totally stray.

No sign of base 2 yet (?).

Lee

--
BasicLinux: Small is Beautiful
http://www.basiclinux.com.ru




  • [BL] dc, 3aoo-cvfd, 02/07/2007
    • Re: [BL] dc, Lee Forrest, 02/07/2007

Archive powered by MHonArc 2.6.24.

Top of Page