Results 1 to 4 of 4

Thread: numbers

  1. #1

    Thread Starter
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729

    numbers

    i think this is very easy...isnt there a function that if i have a numbers like 4,3 4,5 4,6 4,9 it will always round it to 4? or 1,5 1,7 1,2 1,1 it will always round to 1?
    \m/\m/

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539
    Code:
    Math.Round(3.44, 1); //Returns 3.4.
    Math.Round(3.45, 1); //Returns 3.4.
    Math.Round(3.46, 1); //Returns 3.5.

  3. #3
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539
    cast the value to int
    it will round it to the lowest Integer number

    so if you do

    double num = 1.1 //or 1.9
    and you do

    int newNum = (int)num;
    it will make it 1

  4. #4

    Thread Starter
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    ah tks
    \m/\m/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width