If it's being used frequently maybe we should introduce this into misc_math.c.