473,505 Members | 14,950 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

project wide settings

Is it possible in project settings to set vb.net in such a way so that it
considers only upto 3 decimal places when comparing any two values.

My problem is:

i get varA = -0.0000000000018189894035458565. It actaully should be zero.
So when i compare varA = 0 , it returns false (obviously)
I can use round(varA) to achieve what i want, but i have to do that every
time. Is it possible to set it in project settings.

Irfan

Nov 21 '05 #1
2 1034
No. You can't change the way basic mathematical operators work. Especially
on a per project setting, since in the end, the IL is interpreted by the
CLR, who doesn't know or care what project your assembly was compiled in. It
treates all floating point numbers the same way, it's not going to treat
them differently depending on what assembly the code is executing in.

I would suggest you write a function to do the comparison, that will then do
the rounding appropriately. That way comparing 2 numbers is still one call
and you don't have messy rounding code all over the place.

"Irfan Mumtaz" <sp****@spam.net> wrote in message
news:1C**********************************@microsof t.com...
Is it possible in project settings to set vb.net in such a way so that it
considers only upto 3 decimal places when comparing any two values.

My problem is:

i get varA = -0.0000000000018189894035458565. It actaully should be zero.
So when i compare varA = 0 , it returns false (obviously)
I can use round(varA) to achieve what i want, but i have to do that every
time. Is it possible to set it in project settings.

Irfan


Nov 21 '05 #2
thanks Marina for the reply

I will probably create my own function

irfan
"Marina" wrote:
No. You can't change the way basic mathematical operators work. Especially
on a per project setting, since in the end, the IL is interpreted by the
CLR, who doesn't know or care what project your assembly was compiled in. It
treates all floating point numbers the same way, it's not going to treat
them differently depending on what assembly the code is executing in.

I would suggest you write a function to do the comparison, that will then do
the rounding appropriately. That way comparing 2 numbers is still one call
and you don't have messy rounding code all over the place.

"Irfan Mumtaz" <sp****@spam.net> wrote in message
news:1C**********************************@microsof t.com...
Is it possible in project settings to set vb.net in such a way so that it
considers only upto 3 decimal places when comparing any two values.

My problem is:

i get varA = -0.0000000000018189894035458565. It actaully should be zero.
So when i compare varA = 0 , it returns false (obviously)
I can use round(varA) to achieve what i want, but i have to do that every
time. Is it possible to set it in project settings.

Irfan



Nov 21 '05 #3

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

Similar topics

2
8345
by: Yaron Cohen | last post by:
Hi, I would like to ask for your help. I am using IE5.5. I have a wide page with horizontal scroll bar. The problem is that I get only 1 page when printing it using "file->print" or...
18
3142
by: JKop | last post by:
Here's what I know so far: You have a C++ project. You have source files in it. When you go to compile it, first thing the preprocessor sticks the header files into each source file. So now...
11
1846
by: Larry Bird | last post by:
I'm attempting to build my first VC++ .net project and I'm unable to get a clean compile. Please view code below: // This is the main project file for VC++ application project // generated...
8
1466
by: Glenn Thimmes | last post by:
I am needing to read and write application settings from within my ASP.NET application. My web.config is not an option since I need to be able to write settings as well. My database is not an...
7
2644
by: Lance | last post by:
Is there any way to create an import alias that applies to the entire project? For example, lets say that I want "VB" to represent Microsoft.VisualBasic throughout my entire project. Is there...
10
2367
by: ajtaylor | last post by:
Hello, I have a load of native C++ code that I want to use in a CLR class library. My "logic" being that I create a C++/CLI managed class that acts as an interface to the unmanged code. I...
9
9591
by: toton | last post by:
Hi, I have my program using wstring everywhere instead of string. Similarly I need to process some file, which contains unicode or ascii character. I need to stream them. Thus I use wifstream etc....
6
4732
by: TS | last post by:
I cannot get this to work. I added an app.config to a project i reference from my web application project (vs 05) but can see no way to access the settings within it. the other thing is that I...
10
1635
by: =?Utf-8?B?TUNN?= | last post by:
When creating a new VB Web Application Project with VS2008, there are several settings (compiler settings, option strict, etc) that appear both in the web.config file and "My Project". I'm...
0
7216
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
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7303
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
7367
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...
1
7018
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5028
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
407
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.