Move the generic braincode into math.c

Take a couple of the primary parts of the braincode and move them down
into the noble directory.