|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
numbers investigationHi,
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 "andreas" <andr***@pandora.be> schrieb: 'If numbD <= 99999,999 Then...'.> 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 -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> 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 Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message news:eaPyQdulGHA.2136@TK2MSFTNGP04.phx.gbl... > "andreas" <andr***@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/> > 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.. 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 Show quoteHide quote "Cyril Gupta" <nomail@nospam.com> wrote in message news:u6m1oLylGHA.2180@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.. > > > 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 Show quoteHide quote "andreas" <andr***@pandora.be> wrote in message news:dR3ng.499679$_d7.12684343@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" <nomail@nospam.com> wrote in message > news:u6m1oLylGHA.2180@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.. >> >> >> > >
Question about Datasets and ASP.NET
Type xxx not defined #2 dataadapter and stored procs in design time get first 50 characters Multilanguage support Mulitp app.config files in multiple project solution Problems with structure in structure and DLL function call in VB.NET Problems with structure in structure and DLL function call in VB.NET Re: Parse text into words? Load email from a file? |
|||||||||||||||||||||||