Re: How many hex digits make a negative?
- From: "Norman Diamond" <ndiamond@xxxxxxxxxxxxxxxx>
- Date: Fri, 24 Jun 2005 09:32:52 +0900
Thank you for your time and effort in writing, but please notice my question showed that I already knew most of what you were writing and that I was asking where MSDN documents it. The contract between VB and programmers is supposed to be more visible in MSDN than in folklore (including accurate folklore).
That said, I do thank you for the following detail:
force 2-byte...&HFFFF%
I didn't know about that particular suffix. Again, where are the suffixes documented in MSDN? Of course you don't have to know the answer, but if you do know then please kindly say. A certain particular famous company is supposed to know the answer though, so I hope to see it one way or another.
4-byte...&HFFFF&
Yeah that one I know, more or less. If a year passes between two VB projects and I forget about that, I always get to relearn it the hard way.
"Sean Myers" <seanm@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:OYpmA8%23dFHA.3712@xxxxxxxxxxxxxxxxxxxxxxx
"&HFFFF" is 2 bytes long. Compare with CInt("&HFFFF"). The result of this is -1, while the result of the CLng is 65535. VB automatically interprets &HFFFF as a 2-byte integer, while the CLng provides 4 bytes to reside in. The short answer is that it takes as many hex-digits to make a negative number as there are bytes of memory to store it in. The long answer must wait for someone with more time to spend on computer math theory <g>.
Depending on what you are trying to accomplish, you can use the type declaration characters to force 2-byte...&HFFFF% or 4-byte...&HFFFF&
HTH, Sean
"Norman Diamond" <ndiamond@xxxxxxxxxxxxxxxx> wrote in message news:OaTh$O%23dFHA.1456@xxxxxxxxxxxxxxxxxxxxxxxSub Main() If CLng("&HFFFF") = &HFFFF Then Call MsgBox("That would make too much sense!") Else Call MsgBox("Where does MSDN document this?") End If End Sub
.
- Follow-Ups:
- Re: How many hex digits make a negative?
- From: "Peter Huang" [MSFT]
- Re: How many hex digits make a negative?
- References:
- How many hex digits make a negative?
- From: Norman Diamond
- Re: How many hex digits make a negative?
- From: Sean Myers
- How many hex digits make a negative?
- Prev by Date: Re: How many hex digits make a negative?
- Next by Date: Re: How many hex digits make a negative?
- Previous by thread: Re: How many hex digits make a negative?
- Next by thread: Re: How many hex digits make a negative?
- Index(es):