|
-
Oct 12th, 2000, 12:55 PM
#1
ihave a number "hallo", or 0.00568 how can i determine the length of it?
-
Oct 12th, 2000, 01:11 PM
#2
Fanatic Member
Code:
Private Sub Command1_Click()
MsgBox "Length is " & Len(Str(0.00568))
End Sub
Is this what you are looking for ?
-
Oct 12th, 2000, 01:18 PM
#3
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
-
Oct 12th, 2000, 01:21 PM
#4
You could temporarily convert it to a string and then use the len() function. Will that accomplish what you want?
Code:
It looks like someone just posted code for you as I was writing this
As for the second thing:
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]
-
Oct 12th, 2000, 01:23 PM
#5
Fanatic Member
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
-
Oct 12th, 2000, 01:32 PM
#6
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
-
Oct 12th, 2000, 01:52 PM
#7
transcendental analytic
the logaritmical solution 
Code:
msgbox -int(log(0.00005)/2.30258509299405)
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 12th, 2000, 01:55 PM
#8
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
-
Oct 12th, 2000, 02:44 PM
#9
dragonyian,
this page will explain you why you get these strange errors:
(Complete) Tutorial to Understand IEEE Floating-Point Errors
-
Oct 12th, 2000, 02:50 PM
#10
transcendental analytic
eh sorry divide with a bit smaller number or to be really sure log(10)
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 12th, 2000, 04:35 PM
#11
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?
-
Oct 12th, 2000, 04:51 PM
#12
transcendental analytic
Why don't you go try the ten'th logaritm?
Code:
msgbox -int(log(0.00005)/log(10))
should work now, i've tested it out
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 12th, 2000, 06:18 PM
#13
Lively Member
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 = .99
take .99 * 10 and you get 9.99
hope this helps
Flint
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.
-
Oct 13th, 2000, 10:19 AM
#14
Lively Member
Did this help Dragonyian?
Flint
Eating words has never given me indigestion.
— Winston Churchill: 1874-1965, British
politician, writer
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|