Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Rounding Numbers

Reply
Thread Tools

Rounding Numbers

 
 
C
Guest
Posts: n/a
 
      08-25-2003
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

 
Reply With Quote
 
 
 
 
Frank Drebin
Guest
Posts: n/a
 
      08-25-2003
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" <(E-Mail Removed)> wrote in message
news:082301c36b1a$e20620c0$(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
 
 
 
C
Guest
Posts: n/a
 
      08-25-2003
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" <(E-Mail Removed)> wrote in message
>news:082301c36b1a$e20620c0$(E-Mail Removed)...
>> 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
>>

>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
why is rails/ruby automatically rounding to whole numbers. Morgan Morgan Ruby 5 01-23-2010 04:51 AM
rounding of 4 unsigned char numbers asutic C Programming 2 08-01-2008 07:20 PM
Newbie: Looking for help rounding numbers Ja Bo Ruby 4 12-29-2006 04:03 AM
Rounding numbers with sprintf Robert TV Perl Misc 3 06-12-2004 03:04 AM
Rounding Up/Down Numbers aleatory Perl Misc 2 03-02-2004 11:21 AM



Advertisments