ihave a number "hallo", or 0.00568 how can i determine the length of it?
Printable View
ihave a number "hallo", or 0.00568 how can i determine the length of it?
Is this what you are looking for ?Code:Private Sub Command1_Click()
MsgBox "Length is " & Len(Str(0.00568))
End Sub
Ya ya ... that's it... thanks
and by the way, do you know how can we find the location of a number in a series of number
0.0000005
where is the location of 5? it is not aways 5 not i try to dormat the number to 5 * 10^ n somthing like that, so i need to figure out the first number after decimal and 0
once again, tghanks
You could temporarily convert it to a string and then use the len() function. Will that accomplish what you want?
As for the second thing:Code:It looks like someone just posted code for you as I was writing this
Just split(OrigNumber,".") after converting it to a string and then work with mysplit(1) in the rest of the code, that will be only what is after the decimal
[Edited by Edneeis on 10-12-2000 at 02:23 PM]
Similar to this ?
Code:Private Sub Command2_Click()
Dim NumToSearch As Double
Dim NumToLocate As Integer
NumToSearch = 0.0005
NumToLocate = 5
MsgBox InStr(1, NumToSearch, NumToLocate)
End Sub
I think it will not work as it is not always 5 and how about this one?
Y2 = 0.01
Do While Y2 < 1
z = z + 1
Y2 = Y2 * 10
Loop
Text2.Text = Y2
why i can not get y2 as 1 .. but 9.99999999
anyone help here
the logaritmical solution :D
Code:msgbox -int(log(0.00005)/2.30258509299405)
Guru , are you kidding me or what?
i try the example i posted... it doesn't give me 1 but give me 9.999999999999999999999 wonder why, help please
dragonyian,
this page will explain you why you get these strange errors:
(Complete) Tutorial to Understand IEEE Floating-Point Errors
eh sorry :D divide with a bit smaller number or to be really sure log(10)
So, what do you guys think i can do...
what i need is to loop and figure out how small the number is and then make it as 5 *10^6 something like that... any suggestion?
Why don't you go try the ten'th logaritm?
should work now, i've tested it outCode:msgbox -int(log(0.00005)/log(10))
Dragonyian: I posted this reply in the center form thread as well.
The
does not allow the Y varible to become 1. Your code continues to multiply Y(0.01) * 10 until the value of Y = .99Code:do while y <1
take .99 * 10 and you get 9.99
hope this helps
Flint
Quote:
A man will pay $2 for a $1 item he wants. A woman will pay $1 for a $2 item that she doesn't want.
Did this help Dragonyian?
Flint
Quote:
Eating words has never given me indigestion.
— Winston Churchill: 1874-1965, British
politician, writer