none
Convert FLOAT to INT?

Answers

All replies

  • Everyting is possible :). Use Math.Round, Math.Floor and Math.Ceiling methods. Maybe Math.Round will do the job for you, but read about these methods how they round the values, and maybe you will need to create your function that use these functions to round in your way. For example Math.Round works this way:
    Math.Round(1.1) = 1
    Math.Round(1.5) = 2
    Math.Round(1.9) = 2
    Math.Round(2.5) = 2
    Math.Round(2.6) = 3

    Saturday, August 26, 2006 10:15 PM
  • That's not really doing a conversion.... As the imput and the output are both doubles.

    I think what he really wants is a cast:

    double D = 1.234;

    int I = (int) D;      // == 1

     

    Saturday, August 26, 2006 10:52 PM
  • DUH!

    I have just found Convert.ToInt32(...);

    Thanks anyway for your replies!

    Monday, September 04, 2006 2:26 PM