Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Double Integers

Author
Message
sriveros
17
Years of Service
User Offline
Joined: 27th Jul 2007
Location: Edmonton, Alberta
Posted: 25th Oct 2007 09:01 Edited at: 25th Oct 2007 09:13
Hello there,

I really need your help!! There seem to be a bug with double integers! Anybody have an alternative method to using double integers?

I need to be able to take a number as string "20081114125025" and add 10000000000 and get a result of 20091114125025.

Any ideas on how to do this without using double integers? Any DLL that can fix this problem? Anything would really help... Thanks.



Regards,
Sam
Mr Bigger
19
Years of Service
User Offline
Joined: 31st Jan 2005
Location: was here!
Posted: 25th Oct 2007 12:04
I think the problem lies with the val() command not working on that large number.

If i had to do it i would parse the string first.
I mean break it down to 7 digit chunks so it's managable.
Then i would do the math and convert back to string.

Never done it myself so...




AMD 2600+/1GB ram/GeForce 6600oc 256MB/W2KPro/DBPro 6.6.b
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 25th Oct 2007 17:49
Please use meaningful thread titles - I've changed this one.

pcRaider
17
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 26th Oct 2007 14:56
"DOUBLE INTEGER"
"DOUBLE FLOAT"
It has BUG.
It is unfinished.
We must not trust it.
calcyman
17
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 26th Oct 2007 20:46
IanM's Matrix1 Utils has a better integer VAL() command.

Your signature has been erased by a hyper-intelligent pan-dimensional being (a mod)
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 30th Oct 2007 05:28
I like the string parsing idea - you're only talking one digit in your post. However the idea of breaking it into smaller pieces makes it much more "usable" - with this approach.

I don't know your circumstances - but you might just start with smaller pieces to begin with - or parse once and keep the number "parts" in numeric variables - period. Its pretty easy to take a number like 2008 and make a string of it STR$(2008) and its a bit trickeir to parse strings in my opinion.

Ahhh - the beuty of programming problems - there are so many ways to approach them - and many will argue which is correct. I don't believe in correct - I believe in:

1: Does it work?
2: Is it efficient?
3: Can I read the code two monthes from now?

If yes to all three - you're not correct - you're not wrong - just move on!

(I'm being a little silly) but there is some truth to this too. I forget ---ahh.. "Pixel Perfect" has a signature:
Quote: "No matter how great your code - someone will improve upon it"
(or something close) and its very true.

Login to post a reply

Server time is: 2024-11-25 12:55:26
Your offset time is: 2024-11-25 12:55:26