448,814 Members | 1,671 Online
Need help? Post your question and get tips & solutions from a community of 448,814 IT Pros & Developers. It's quick & easy.

# rounding float toward zero?

 P: n/a Converting single to int Rounds the upper number if the part after dot is bigger than 0,5. But I want to discard the value after dot. May 9 '07 #1
5 Replies

 P: n/a On May 9, 4:23 pm, "Yasin cepeci"

 P: n/a Use, Math.Floor "Yasin cepeci"

 P: n/a Yasin, You can pass this to the static Floor method on the Math class. Generally speaking though, you can use the following formula to find the floor or ceiling for any number: floor = round(number - 0.5) ceiling = round(number + 0.5) Assuming that rounding will round to the next highest integer for values of .5 and above. Hope this helps. -- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com "Yasin cepeci"

 P: n/a On May 9, 4:32 pm, "Ignacio Machin \( .NET/ C# MVP \)"

 P: n/a it works thank you so much . happy days "Jon Skeet [C# MVP]" , haber iletisinde sunlari yazdi:11**********************@p77g2000hsh.googleg roups.com... On May 9, 4:23 pm, "Yasin cepeci" Converting single to int Rounds the upper number if the part after dot isbigger than 0,5. But I want to discard the value after dot. I think Math.Truncate(double) is what you're after. Jon May 9 '07 #6

### This discussion thread is closed

Replies have been disabled for this discussion.