formats.c: handle possible floating point rounding issue