   c++ need math round function
  I need a function that rounds a number eg, round 0.0543 to 2 decimal places is 0.05.I can''t find any functions for this in c++ 
  you don''t need a function.if you want to round to n decimal places first multiply by 10^n, cast to an int and back to a float, and then divide by 10^n. ;  Isn''t that like the first or second assignment in Programming 101?   Kami no Itte ga ore ni zettai naru! ;  R Daneel Olivaw - watch out for integer overflows.   “Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”    — Brian W. Kernighan (C programming language co-inventor);  Really, it depends on what kind of rounding you want.  Do you want to round down or round to the nearest?  The int-cast method is ok, but like was already mentioned, you may have to worry about overflow if you''re dealing with very large numbers. ;  Good point Fruny. You have about 2 billion worth of headroom so if x*10^n (where x is your input value) is anywhere near that there could be trouble.To prevent overflow, first split the value into its integer and fractional parts. Then round the fraction part the way I described before and add back the integer part. 