Rounding Numbers

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • C

    Rounding Numbers

    Hi,

    I have some logic that rounds decimal numbers

    E.g

    Math.Round(2657 9.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

    #2
    Re: Rounding Numbers

    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" <c@nospa.com> wrote in message
    news:082301c36b 1a$e20620c0$a00 1280a@phx.gbl.. .[color=blue]
    > Hi,
    >
    > I have some logic that rounds decimal numbers
    >
    > E.g
    >
    > Math.Round(2657 9.80)
    >
    > This gives
    > 26580
    >
    > However I want to get the nearest thousand which should
    > give
    > 27000
    >
    > How can I do this?
    >
    > Thanks,
    > C
    >[/color]


    Comment

    • C

      #3
      Re: Rounding Numbers

      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?
      [color=blue]
      >-----Original Message-----
      >Take the original number, divide by 1000 - then round[/color]
      that number... then[color=blue]
      >multiply by 1000..
      >
      >A) 26580 / 1000 = 26.58
      >B) 26.58 rounded = 27
      >C) 27 * 1000 = 27000
      >
      >What do you think?
      >
      >"C" <c@nospa.com> wrote in message
      >news:082301c36 b1a$e20620c0$a0 01280a@phx.gbl. ..[color=green]
      >> Hi,
      >>
      >> I have some logic that rounds decimal numbers
      >>
      >> E.g
      >>
      >> Math.Round(2657 9.80)
      >>
      >> This gives
      >> 26580
      >>
      >> However I want to get the nearest thousand which should
      >> give
      >> 27000
      >>
      >> How can I do this?
      >>
      >> Thanks,
      >> C
      >>[/color]
      >
      >
      >.
      >[/color]

      Comment

      Working...