473,386 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Rounding Numbers

C
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

Nov 17 '05 #1
2 1248
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:08****************************@phx.gbl...
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

Nov 17 '05 #2
C
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... thenmultiply 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:08****************************@phx.gbl...
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

.

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ron Adam | last post by:
With all the discussion about numbers here and particularly in regards to prePEP concerning decimal data types got me wondering about how numbers are handled when it comes to rounding. And if that...
2
by: Christopher T King | last post by:
Speakign of rounding errors, why is round() defined to round away from zero? I've always been quite fond of the mathematical definition of rounding of floor(n+.5). As a contrived example of why the...
3
by: Caesar Augustus | last post by:
Hello Tom, Long time listener, first time caller... I have been working with vb code to automate a salary increase process that not only rounds to the nearest penny but also rounds to the...
13
by: dhildebrandt | last post by:
I have a query that uses the Round function to change decimals into whole numbers. For 4 years straight the thing has always rounded the numbers in exactly the same way so that whenever I update...
3
by: Norvin Laudon | last post by:
Hi, Can somebody explain the following, from the MSDN documentation for the "System.Convert.ToInt32(double)" function <quote> Return Value value rounded to the nearest 32-bit signed...
9
by: Joe Attardi | last post by:
Hi all, Math is not my strongest area so forgive me if I use some of the wrong terminology. It seems that scientific notation is immune to rounding errors. For example: (4.98 * 100) + 5.51 ...
11
by: cj | last post by:
Lets assume all calculations are done with decimal data types so things are as precise as possible. When it comes to the final rounding to cut a check to pay dividends for example in VB rounding...
29
by: Marco | last post by:
Hello, I have : float f = 36.09999999; When I do : char cf; sprintf(cf,"%0.03lf", f); I get : 36.100
206
by: md | last post by:
Hi Does any body know, how to round a double value with a specific number of digits after the decimal points? A function like this: RoundMyDouble (double &value, short numberOfPrecisions) ...
30
by: bdsatish | last post by:
The built-in function round( ) will always "round up", that is 1.5 is rounded to 2.0 and 2.5 is rounded to 3.0. If I want to round to the nearest even, that is my_round(1.5) = 2 # As...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.