format decimal by converting it to the whole part and the fractional part