leah blogs

July 2013

19jul2013 · Summer of Scripts: base

base is really simple program to convert numbers between various bases.

% base 255
255 = 11111111 255 0377 0xff
% base 0644
0644 = 110100100 420 0644 0x1a4
% base 0b111
0b111 = 00000111 7 07 0x7
% base 0xdeadbeef
0xdeadbeef = 11011110101011011011111011101111 3735928559 033653337357 0xdeadbeef

It also supports the Ruby syntax for writing integer literals, as well as arbitrarily large numbers (easy, because it’s written in Ruby):

% base 100_000
100_000 = 11000011010100000 100000 0303240 0x186a0

NP: Lia Ices—Ice Wine

Copyright © 2004–2018