Rounding Numbers

Discussion in 'ASP .Net' started by C, Aug 25, 2003.

  1. C

    C Guest

    Hi,

    I have some logic that rounds decimal numbers

    E.g

    Math.Round(26579.80)

    This gives
    26580

    However I want to get the nearest thousand which should
    give
    27000

    How can I do this?

    Thanks,
    C
    C, Aug 25, 2003
    #1
    1. Advertising

  2. C

    Frank Drebin Guest

    Take the original number, divide by 1000 - then round that number... then
    multiply by 1000..

    A) 26580 / 1000 = 26.58
    B) 26.58 rounded = 27
    C) 27 * 1000 = 27000

    What do you think?

    "C" <> wrote in message
    news:082301c36b1a$e20620c0$...
    > Hi,
    >
    > I have some logic that rounds decimal numbers
    >
    > E.g
    >
    > Math.Round(26579.80)
    >
    > This gives
    > 26580
    >
    > However I want to get the nearest thousand which should
    > give
    > 27000
    >
    > How can I do this?
    >
    > Thanks,
    > C
    >
    Frank Drebin, Aug 25, 2003
    #2
    1. Advertising

  3. C

    C Guest

    Thanks for your reply.

    I am adding a series of numbers that are like 200,1243.42

    I then want to round to the nearest thousand?

    Any ideas?

    >-----Original Message-----
    >Take the original number, divide by 1000 - then round

    that number... then
    >multiply by 1000..
    >
    >A) 26580 / 1000 = 26.58
    >B) 26.58 rounded = 27
    >C) 27 * 1000 = 27000
    >
    >What do you think?
    >
    >"C" <> wrote in message
    >news:082301c36b1a$e20620c0$...
    >> Hi,
    >>
    >> I have some logic that rounds decimal numbers
    >>
    >> E.g
    >>
    >> Math.Round(26579.80)
    >>
    >> This gives
    >> 26580
    >>
    >> However I want to get the nearest thousand which should
    >> give
    >> 27000
    >>
    >> How can I do this?
    >>
    >> Thanks,
    >> C
    >>

    >
    >
    >.
    >
    C, Aug 25, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. asutic

    rounding of 4 unsigned char numbers

    asutic, Aug 1, 2008, in forum: C Programming
    Replies:
    2
    Views:
    255
    Herbert Kleebauer
    Aug 1, 2008
  2. Ja Bo
    Replies:
    4
    Views:
    106
    Ja Bo
    Dec 29, 2006
  3. Morgan Morgan
    Replies:
    5
    Views:
    133
    Josh Cheek
    Jan 23, 2010
  4. aleatory

    Rounding Up/Down Numbers

    aleatory, Mar 2, 2004, in forum: Perl Misc
    Replies:
    2
    Views:
    78
    Tore Aursand
    Mar 2, 2004
  5. Robert TV

    Rounding numbers with sprintf

    Robert TV, Jun 12, 2004, in forum: Perl Misc
    Replies:
    3
    Views:
    237
    Gunnar Hjalmarsson
    Jun 12, 2004
Loading...

Share This Page