josdejong/mathjs — pull request #16 by oskbor (2013-06-16 18:59:09+00:00)
Title: Unit calculations

So I went ahead and implemented some basic unit arithmetic :)
**Things that works**
```
a = 1m
> 1 m
b = 2s
> 2 s
a/b
> 500 mm/s

a = 100m
> 100 m
b = 3.4s
> 3.4 s
c = a/b
> 29.412 m/s
d = c/1.1s
> 26.738 m/s2
d * 1kg
> 26.738 N

sqrt(2m2)
> 1.4142 meter

square(3m)
> 9 m2
```

**Issues with / in unit names**

Since / does not work when assigning a unit, I circumvented the problem by using p instead of the slash.

a= 1m/s
Infinity m/s
a = 1mps
1 mps

**Ambiguous prefixes**

1km * 200m
200 km2
this means 200k m2 and not 200 (km)2
This issue is not created by this pull request, but it might be confusing when a exponent is present at the same time as a prefix, especially when doing arithmetics.

This is my first try at a pull request. Let me know what you think! Im willing to put more work into it if you find things not to your liking.