473,499 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

numbers investigation

Hi,
I have to investigate many decimal numbers if they are integral or not and I
know that max =99999,999..
What I do is :

str = cStr(numbD)
If str.length <= 5 then ...

I wonder if this is the fasted method to do so
Thanks for any responsE


Jun 23 '06 #1
5 966
"andreas" <an*****@pandora.be> schrieb:
I have to investigate many decimal numbers if they are integral or not and
I
know that max =99999,999..
What I do is :

str = cStr(numbD)
If str.length <= 5 then ...

I wonder if this is the fasted method to do so


'If numbD <= 99999,999 Then...'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jun 23 '06 #2
No, Herfried maybe I make myself not clear anough.
I want to check out if the number is f.e. 89457 and not 89457,14578245781
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ea**************@TK2MSFTNGP04.phx.gbl...
"andreas" <an*****@pandora.be> schrieb:
I have to investigate many decimal numbers if they are integral or not and I
know that max =99999,999..
What I do is :

str = cStr(numbD)
If str.length <= 5 then ...

I wonder if this is the fasted method to do so


'If numbD <= 99999,999 Then...'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jun 23 '06 #3
I am sorry, but I can't see how this code helps. This will merely tell you
whether the number is less than 5 characters long... mm.. How does it help
you find that the number has no fractions?

Maybe you can simply use this

if mynum = int(mynum) then
my number is integral

hmm.. i hope i didn't understand what you wanted to do..

Jun 24 '06 #4
Yes, I think that the code helps
f.e. I want to know of NumberD^0.3 is integral
This is true as cstr(NUmberD^0.3).lenght <= 5 (I know that NumberD
<=99999,999999999)
Don't you agree?
Thanks for your answer
"Cyril Gupta" <no****@nospam.com> wrote in message
news:u6**************@TK2MSFTNGP05.phx.gbl...
I am sorry, but I can't see how this code helps. This will merely tell you
whether the number is less than 5 characters long... mm.. How does it help
you find that the number has no fractions?

Maybe you can simply use this

if mynum = int(mynum) then
my number is integral

hmm.. i hope i didn't understand what you wanted to do..

Jun 24 '06 #5
But ....

(CStr(123.4).Length <= 5) = True

but 123.45 is not integral.

Also, if you use (_num = Int(_num)) then you will run into rounding issues
on various numeric values.

In my opinion it is best to use the Fix method:

If Fix(_num) = _num Then
' _num is integral
If _num <= 99999 Then
' _num is in range
End If
End If

or

If Fix(_num) = _num AndAlso _num <= 99999 Then
' _num is integral and it is in range
End If
"andreas" <an*****@pandora.be> wrote in message
news:dR***********************@phobos.telenet-ops.be...
Yes, I think that the code helps
f.e. I want to know of NumberD^0.3 is integral
This is true as cstr(NUmberD^0.3).lenght <= 5 (I know that NumberD
<=99999,999999999)
Don't you agree?
Thanks for your answer
"Cyril Gupta" <no****@nospam.com> wrote in message
news:u6**************@TK2MSFTNGP05.phx.gbl...
I am sorry, but I can't see how this code helps. This will merely tell
you
whether the number is less than 5 characters long... mm.. How does it
help
you find that the number has no fractions?

Maybe you can simply use this

if mynum = int(mynum) then
my number is integral

hmm.. i hope i didn't understand what you wanted to do..


Jun 25 '06 #6

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

Similar topics

4
10720
by: August1 | last post by:
A handful of articles have been posted requesting information on how to use these functions in addition to the time() function as the seed to generate unique groups (sets) of numbers - each group...
16
2416
by: StenKoll | last post by:
Help needed in order to create a register of stocks in a company. In accordance with local laws I need to give each individual share a number. I have accomplished this by establishing three tables...
12
5195
by: Jim Michaels | last post by:
I need to generate 2 random numbers in rapid sequence from either PHP or mysql. I have not been able to do either. I get the same number back several times from PHP's mt_rand() and from mysql's...
7
3985
by: Gerard Flanagan | last post by:
All would anyone happen to have code to generate Cutter Numbers: eg. http://www1.kfupm.edu.sa/library/cod-web/Cutter-numbers.htm or is anyone looking for something to do?-) (I'm under...
7
4876
by: newstips6706 | last post by:
1, 2, 3, 5, 7... PRIME Numbers ________________________________ Definitions What is a PRIME Number ?
2
1361
by: Jim H | last post by:
My AssemblyInfo file has My file version is now 1.0.2594.35196 How do I control this. Where is this stored? What is the difference between build and revision? Thanks in advance, jim
24
7173
by: pereges | last post by:
I need to generate two uniform random numbers between 0 and 1 in C ? How to do it ? I looked into rand function where you need to #define RAND_MAX as 1 but will this rand function give me ...
4
1343
by: =?Utf-8?B?QnJhc3NpY2FOaWdyYQ==?= | last post by:
Greetings, I am writing an application that prepares a quotation for a customer. The calculations are done in a SQL Server stored procedure. I use a datareader to fetch the record, but cannot...
0
7014
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
7180
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
7229
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
6905
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...
0
7395
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5485
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
311
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.