added math library and fixed a switch that was falling through in GX3