ra*************@gmail.com wrote:
Consider the following code snippet
------------------
float fi=12.598;
printf("\n %.2f \n",fi);
------------------
the output of this would be 12.60 (note when we give the conversion
specifier as "%.2f" the result is rounded to 12.60)
My requirement is the value be 12.59 instead of 12.60.Are there any
conversion specifier that suppress this rounding
No, there is no conversion specifier to suppress rounding, and are you
sure you want to, even if you get 12.599999999999? And do you always
want to round down, or do you always want to truncate? In other words,
should -12.598 be printed as -12.59, or as -12.60? Depending on your
needs, you can add or subtract 0.005 or slightly less, and then print
the result of that.