clojure/math.numeric-tower — pull request #4 by xpe (2014-01-17 03:23:39+00:00)
Title: Make the return type of (expt _ 0) match 0

Here are three examples of how `expt` currently behaves:

```clj
(expt 2 1) ; 2
(expt 2M 1) ; 2M
(expt 2N 1) ; 2N
```

I mention them to show that the return type matches the base.

Here are three examples of how `expt` behaves -- but the types of the last two are problematic:

```clj
(expt 2 0) ; 1
(expt 2M 0) ; 1
(expt 2N 0) ; 1
```

For symmetry, we would want this instead -- where the return values match the base:

```clj
(expt 2M 0) ; 1M
(expt 2N 0) ; 1N
```

This pull request is based on a real-world use case where I need to guarantee a BigDecimal return types through calculations. As you can see above, `expt` almost always gives BigDecimal; but when the power is 0, it returns 1 as a long. This asymmetry led to subtle bugs in my application; at present, I have to work around this asymmetry in numeric-tower.