A library, and set of applications for manipulating duodecimal (base-12) numbers.
Adds documentation.
Moved files around for a more sane directory structure

heads

tip
browse log

clone

read-only
https://hg.sr.ht/~ser/DuoDecimal
read/write
ssh://hg@hg.sr.ht/~ser/DuoDecimal

+++ title = "duodecimal" description = "A library, and set of applications for manipulating duodecimal (base-12) numbers." tags = [ "haskell", tool" ] categories = [ "Utility" ] +++

#DuoDecimal

A library, and set of applications for manipulating duodecimal (base-12) numbers. The library provides mechanisms for adding, multiplying, subtracting, and dividing numbers.

The Base package provides tools for manipulating numbers in any base; see the DuoDecimal.hs file for example usage.

In addition to the Haskell library, this project provides a GUI RPN calculator as well as a command line tool for conversions and for evaluating expressions containing duodecimal numbers. The RPN calculator requires GTK2 and the Haskell library gtk2hs.

#GUI

Dependencies: gtk2hs

ghc --make -isrc -odir out -hidir out -o duodecimal src/Control.hs

Run ./duodecimal. The calculator understands duodecimal numbers (10 => A, 11 => B), *, /, +, -, and Backspace. Backspace pops the top item from the stack; the other keys are evaluated in-line.

#Bugs, Caveats

The GUI isn't terribly smart. It doesn't handle exceptions very well, such as trying to pop from an empty stack, or trying to perform a calculation on an insufficient number of arguments. It also won't be very happy to receive ill-formed numbers; basically, there's very little error checking.

The calculator only takes floating point numbers out to 10 decimal places; you can change this in DuoDecimal.hs.

#Command line

Dependencies: None

ghc --make -isrc -odir out -hidir out -o dd src/Main.hs

Run ./dd without arguments for help.

#Bugs, Caveats:

None, although poorly formatted numbers (too many decimals, illegal characters) may result in cryptic error messages.