improved mathfns tests