new safe_float_math function provided by Pascal