Calculator

This is a simple integer calculator built upon the elm-integer library. It's designed to make it easy to test out all the integer input formats, arithmetic operations, and integer output formats that's supported by the library.

Input

You can enter your expression using an S-expression based language.

The following syntax is supported:

    Expr      ::= Integer
                | '(' 'abs' Expr ')'
                | '(' 'negate' Expr ')'
                | '(' 'add' Expr* ')'
                | '(' 'sub' Expr Expr ')'
                | '(' 'mul' Expr* ')'
                | '(' 'div' Expr Expr ')'
                | '(' 'mod' Expr Expr ')'
                | '(' 'quot' Expr Expr ')'
                | '(' 'rem' Expr Expr ')'
                | '(' 'exp' Expr Expr ')'
    Integer   ::= Sign Magnitude
    Sign      ::= '-'?
    Magnitude ::= ('0b' | '0B') Binary
                | ('0o' | '0O') Octal
                | ('0x' | '0X') Hex
                | Decimal
    Binary    ::= [0-1]+
    Octal     ::= [0-7]+
    Hex       ::= [0-9a-fA-F]+
    Decimal   ::= [0-9]+
  

Output Options

Select how you would like your integer result to be formatted.

Output

The result of your calculation will appear here.