473,385 Members | 2,243 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,385 software developers and data experts.

How to knock off decimal places..

I have some code that divides a number and then prints this number. It
performs a cost rollup basically and then adds a percentage. The code works
fine except that the number returned has many figures afert the decimal
point (as you would expect really)
How can I remove these ? I am not really concerned about rounding up or
down, just removing to give me a whole number....

Many Thanks
Davey
Dec 5 '05 #1
6 5316
Davey wrote on 05 dec 2005 in microsoft.public.inetserver.asp.general:
I have some code that divides a number and then prints this number. It
performs a cost rollup basically and then adds a percentage. The code
works fine except that the number returned has many figures afert the
decimal point (as you would expect really)
How can I remove these ? I am not really concerned about rounding up
or down, just removing to give me a whole number....


If you are programming in ASP-vbscript:

formatnumber()

This is very basic, please read up on vbscript internal functions.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Dec 5 '05 #2
No problem. I have found it !!

"Davey" <da*************@spooner-vicars.com> wrote in message
news:O9****************@TK2MSFTNGP10.phx.gbl...
I have some code that divides a number and then prints this number. It
performs a cost rollup basically and then adds a percentage. The code works fine except that the number returned has many figures afert the decimal
point (as you would expect really)
How can I remove these ? I am not really concerned about rounding up or
down, just removing to give me a whole number....

Many Thanks
Davey

Dec 5 '05 #3
Hi Evertjan,

I have used the FormatNumber() as you suggest. However, I am also using the
FormatCurrency() to display a cost as currency. This works fine but I get
different currency symbols on different servers !
I have checked the Regional Settings in control on both servers and they are
both set the same, but one displays $, and the other displays £....
Any ideas why this should be ??

Cheers
Davey
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242...
Davey wrote on 05 dec 2005 in microsoft.public.inetserver.asp.general:
I have some code that divides a number and then prints this number. It
performs a cost rollup basically and then adds a percentage. The code
works fine except that the number returned has many figures afert the
decimal point (as you would expect really)
How can I remove these ? I am not really concerned about rounding up
or down, just removing to give me a whole number....


If you are programming in ASP-vbscript:

formatnumber()

This is very basic, please read up on vbscript internal functions.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Dec 6 '05 #4
It's because you are not looking at the correct Regional Settings. When you
look at Regional Settings, you are looking at your OWN settings. ASP runs
under a different user account. The default user account settings is US. You
should consider setting LCID in your application:
http://www.aspfaq.com/show.asp?id=2260

Davey wrote:
Hi Evertjan,

I have used the FormatNumber() as you suggest. However, I am also
using the FormatCurrency() to display a cost as currency. This works
fine but I get different currency symbols on different servers !
I have checked the Regional Settings in control on both servers and
they are both set the same, but one displays $, and the other
displays £....
Any ideas why this should be ??

Cheers
Davey
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242...
Davey wrote on 05 dec 2005 in
microsoft.public.inetserver.asp.general:
I have some code that divides a number and then prints this number.
It performs a cost rollup basically and then adds a percentage. The
code works fine except that the number returned has many figures
afert the decimal point (as you would expect really)
How can I remove these ? I am not really concerned about rounding up
or down, just removing to give me a whole number....


If you are programming in ASP-vbscript:

formatnumber()

This is very basic, please read up on vbscript internal functions.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Dec 6 '05 #5
Davey wrote on 06 dec 2005 in microsoft.public.inetserver.asp.general:
"Evertjan." <ex**************@interxnl.net> wrote in message
Davey wrote on 05 dec 2005 in
microsoft.public.inetserver.asp.general:
> I have some code that divides a number and then prints this number.
> It performs a cost rollup basically and then adds a percentage. The
> code works fine except that the number returned has many figures
> afert the decimal point (as you would expect really)
> How can I remove these ? I am not really concerned about rounding
> up or down, just removing to give me a whole number....
If you are programming in ASP-vbscript:

formatnumber()

This is very basic, please read up on vbscript internal functions.


[please do not toppost on usenet]
I have used the FormatNumber() as you suggest. However, I am also
using the FormatCurrency() to display a cost as currency. This works
fine but I get different currency symbols on different servers !
I have checked the Regional Settings in control on both servers and
they are both set the same, but one displays $, and the other displays
£.... Any ideas why this should be ??


Never use FormatCurrency() in an internet setting, as both the server
regional settings and the clients available fonts have influence.

<% = "€&nbsp;" & FormatNumber(yourGainOrLoss,2) %>

will do what you(?) want.

In general avoid coding that is dependent on regional settings,
though both the decimal and thousands character
are influenced by it in FormatNumber()

€ 1.234,56

or

€ 1,234.56

or ....

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Dec 6 '05 #6
Thanks Evertjan.

I see what you mean with using the FormatCurrency.

Thankyou for your help
Cheers
Davey
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.242...
Davey wrote on 06 dec 2005 in microsoft.public.inetserver.asp.general:
"Evertjan." <ex**************@interxnl.net> wrote in message
Davey wrote on 05 dec 2005 in
microsoft.public.inetserver.asp.general:

> I have some code that divides a number and then prints this number.
> It performs a cost rollup basically and then adds a percentage. The
> code works fine except that the number returned has many figures
> afert the decimal point (as you would expect really)
> How can I remove these ? I am not really concerned about rounding
> up or down, just removing to give me a whole number....

If you are programming in ASP-vbscript:

formatnumber()

This is very basic, please read up on vbscript internal functions.


[please do not toppost on usenet]
I have used the FormatNumber() as you suggest. However, I am also
using the FormatCurrency() to display a cost as currency. This works
fine but I get different currency symbols on different servers !
I have checked the Regional Settings in control on both servers and
they are both set the same, but one displays $, and the other displays
£.... Any ideas why this should be ??


Never use FormatCurrency() in an internet setting, as both the server
regional settings and the clients available fonts have influence.

<% = "?&nbsp;" & FormatNumber(yourGainOrLoss,2) %>

will do what you(?) want.

In general avoid coding that is dependent on regional settings,
though both the decimal and thousands character
are influenced by it in FormatNumber()

? 1.234,56

or

? 1,234.56

or ....

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Dec 7 '05 #7

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

Similar topics

17
by: John Bentley | last post by:
John Bentley: INTRO The phrase "decimal number" within a programming context is ambiguous. It could refer to the decimal datatype or the related but separate concept of a generic decimal number....
3
by: Brent Bortnick | last post by:
Does anyone know how to find out the number of decimal places a number has. I need this info so that i can round to 3 decimal places if the number has 3 decimal places or to 2 decimal places if...
2
by: Carl G | last post by:
I am storing a 0.000 a System.Decimal in a DataRow. On retrieval the value is only 0 without the three decimal places. It looks like the Get property returns System.Decimal.Zero, but why???? I...
4
by: italia | last post by:
I changed the Fieldsize Property from text to Long Integer and Decimal Places = 6. I had decimals in the original field. But after the transfer, the digits after the decimals are gone. Now...
8
by: nick | last post by:
printf("%lf",3.25); the result is 3.25000 i want the answer correct to 3 decimal places What should i do? thanks!
3
by: mohaaron | last post by:
Hello All, Does anyone know of a way to test a decimal for the number of places it has before and after the decimal? I need to do something like this. decimal value1 = 172.45; // If value1...
19
by: VK | last post by:
http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/ b495b4898808fde0> is more than one month old - this may pose problem for posting over some news servers. This is why I'm...
2
by: hunslair | last post by:
This is a really basic question. I am taking a teach yourself beginners course on Access 2003 and have run into a road block on one practice. In a select query, I have created a simple calculation...
3
by: David | last post by:
Any ideas why this statement: mBalanceChange = Double.Parse(strCurrentBalance, Globalization.NumberStyles.AllowThousands Or Globalization.NumberStyles.AllowDecimalPoint) - mBalanceDouble ...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.