# Surreal numbers

Surreal numbers were found by John Horton Conway and named by Donald E. Knuth. Below a simple calculator for (small) surreal numbers. Small surreal numbers, because calculations using the basic rules set by Conway quickly require large number of operations. In the input it is possible to type number expressions using '{', '|', and '}'. It is also possible to use operators '+' and '-' to add and negate numbers. Numbers can be compared with '<', '<=', and '=='. Because numbers get quickly large, it is possible to define variables with a name, followed by '=', and an expression. An example input is:

```zero = {|}
one = {zero|}
half = {zero|one}
twohalf = half+half
twohalf == one
zzero = one+-one
zero == zzero
```

There is no check if numbers are correct, but the operations do normalize the values, by always taking the largest number for the left and the smallest number for the right. The trace shows which internal routines were called to calculate the results.

Input:

Output:

Trace: