a bunch of fixes for libm