First attempt at BF for 2165 and added better tests for scalarmath pow function

This closes #621 but brings up what may be a new nastier bug.

It seems that the type conversions that you can build into ufuncs (for example in the codegen file for the npymath files) only work when you call the ufunc from python, and not when you call the generated function from c.