Unfortunately, that large of a number is too much for even a Long.
Singles and Doubles can hold it, but because they use significant digits, the value of the number gets changed.
With Single:
Entered 144614369260322395
Returned 144614366354866176
With Double:
Entered 144614369260322395
Returned 144614369260322400
My best suggestion would be to convert the hex into a String, and whenever you make comparisons, if you make any, just make sure the value it's being compared against gets put into CStr().
Strings can perform direct comparisons with number strings perfectly as far as I can see, so "500" < "600" will return True, "455" <= "300" will return False, "400" <> "400" will return False, etc.
Last edited by ChaosTheEternal; December 14th, 2005 at 08:51 AM.
Hi !
I'm working on that. Hope to present you a solution soon. 100 decimal digits are enough ?
Jonny Poet
Jonny Poet
To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
If anyone felt he has got help, show it in rating the post.
Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ? My latest articles : Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
Here are some converterfunctions I have done for u, working up to 100 decimal digits
Please test them. Hope that helps
Jonny Poet
Jonny Poet
To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
If anyone felt he has got help, show it in rating the post.
Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ? My latest articles : Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
...
My best suggestion would be to convert the hex into a String, and whenever you make comparisons, if you make any, just make sure the value it's being compared against gets put into CStr()....
Yea, but I think he has to compare long decimals against hex values !! so he has to convert one of them before he can compare.
So I did some converters.
Jonny Poet
Jonny Poet
To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
If anyone felt he has got help, show it in rating the post.
Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ? My latest articles : Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
Yea, but I think he has to compare long decimals against hex values !! so he has to convert one of them before he can compare.
So I did some converters.
Jonny Poet
Hey Jonny you are great... Thanks for help.
P.S : I love this site.... I think the best coding site on the planet
Last edited by jdavide; December 15th, 2005 at 01:13 AM.
Yes I tried that, but putting in, the given number 144614369260322395 is changed to an format with exponent ( I dont know english expression ) 1446...E+17 something like that so its not really usable I think.
I'll do that from a string-number like "1446..." into a hex string in the evening ( Its just now 3 PM in Vienna) so in some hours it should be done
Jonny Poet
Jonny Poet
To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
If anyone felt he has got help, show it in rating the post.
Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ? My latest articles : Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
Strings can perform direct comparisons with number strings perfectly as far as I can see, so "500" < "600" will return True, "455" <= "300" will return False, "400" <> "400" will return False, etc.
Just one note here ... the above examples work because they the same length.. if you try "9" < "10" you get false.. because in text digit 1 is compared to Digit 1 then digit 2, 3.....
Just one note here ... the above examples work because they the same length.. if you try "9" < "10" you get false.. because in text digit 1 is compared to Digit 1 then digit 2, 3.....
In this case use format to add in leading 0's
Gremmy
Yes Gremmy you talked out of my soul. Yesterday I want to mention that, then I forgot. Today it was on my list to do that. You did
BTW I just started to program the Long-Decimal-string to Binary and to Hex functions. Will be ready soon I hope.
Last edited by JonnyPoet; December 15th, 2005 at 01:54 PM.
Jonny Poet
To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
If anyone felt he has got help, show it in rating the post.
Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ? My latest articles : Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
For comparing strings, you could opt to check the lengths of them first, then the strings.
Code:
If Len(strOne) = Len(strTwo) Then
If strOne > strTwo Then MsgBox "strOne is larger"
If strOne < strTwo Then MsgBox "strTwo is larger"
If strOne = strTwo Then MsgBox "strOne = strTwo"
Else
If Len(strOne) > Len(strTwo) Then MsgBox "strOne is larger"
If Len(strOne) < Len(strTwo) Then MsgBox "strTwo is larger"
End If
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.