View previous topic :: View next topic |
Author |
Message |
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Tue Apr 24, 2007 4:53 pm Post subject: Possible bug in @Val() function |
|
|
Hi All,
I just wanted to make you aware that there seems to be a bug in the @Val() function when trying to interpret the value of a LargeInt 64bit integer. The number I am trying to interpret is 9223372036854775 which falls in the range of a 64bit integer (i.e. ... −9223372036854775808 to +9223372036854775807) The @Val() function returns this number as a floating point number like 9.22337203685478E15.... It seems that VDS is 4 digits shy of supporting 64bit integers. The reason for this is prob. because VDS is trying to treat the LargeInt's as Double's internally however they are not the same since the last few bits are used for managing the Mantessa with Double's and they are not with LargInt's.
Code: |
# This does not work
%A = @Val(@Binary(LargeInt,9223372036854775))
If @Equal(%A,9223372036854775)
Info Your number is in range %A@CR()
Else
Warn Number not in range
End
|
Code: |
# This works
%A = @Val(@Binary(LargeInt,922337203685477))
If @Equal(%A,922337203685477)
Info Your number is in range %A@CR()
Else
Warn Number not in range
End
|
I will see if I can build a work around and keep you posted. _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Mon Apr 30, 2007 8:39 am Post subject: |
|
|
VDS 5 is entirely 32-bit. VDS 6 uses 64-bit integers, so it should be OK, though that isn't much use to you at the moment. _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Apr 30, 2007 1:26 pm Post subject: |
|
|
Jules,
That's fine... I just wanted to make everyone aware of this bug in VDS 5 is all
I know that under a 32bit compiler support of 64bit integers is implementation dependent. Actually I was surprised that VDS 5 had 64bit integers since VDS is compiled in an old version of Delphi. I just figured you used a component to manage the 64bit integers. I know in GadgetX I had to push and pop a qword using Assembly to and from the stack to support it in the API calls. I was lucky that the LccWin32 C compiler I use to develop GadgetX has direct 64bit integer support so I was able to keep the resolution of the numbers eventhough it did cost 100kb in the size of the DLL. I didn't have to do anything special to translate the numbers to strings. _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
jules Professional Member
Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Mon Apr 30, 2007 8:37 pm Post subject: |
|
|
VDS 5 doesn't support 64bit integers. As you rightly deduce, the number is handled as a Double to avoid overflow. I suppose the Val function could have done its own conversion to an integer string, but then none of the integer math functions would be able to handle it, so you'd still have a problem. _________________ The Tech Pro
www.tech-pro.net |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Apr 30, 2007 9:06 pm Post subject: |
|
|
Jules,
Yep you would be correct however my GadgetX.dll has 64bit Integer Math functions built into it so that would not be an issue for me.
But that was not how I stumbled across this. The reason this bug came up was because of a enhanced registry DSU I am writting which would allow the programmer to read and write REG_QWORD values. It currently has the ability to read and write those values but it cannot handle more than 15 digits as discussed above. Also it adds the ability to do this remotely and has support for the 64bit view of the registry under a 64bit version of Windows, hence the reason that I call it an enhanced Registry DSU. You can find the beginings of this DSU Here Since my last post I have added a bunch of stuff and was just trying to get 64bit integer support is all. The DSU so far has been written in pure VDS and I am trying to keep it that way if possible. _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
|