Using modf to get fractional part is faster.