Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BitTest'ing numbers larger then 32 bits
Message
From
01/01/2021 15:16:31
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01677684
Message ID:
01677703
Views:
64
>
>Hi,
>
>You can write special UDF for 64 bit numbers and call if you need it.
>
>LOCAL m.lnX, m.lii
>m.lnX=0xFFFFFFFF+1
>
>FOR m.lii=1 TO 32
>?m.lii, VFP64_BITTEST(m.lnX, m.lii)
>NEXT
>RETURN
>
>PROCEDURE VFP64_BITTEST
>LPARAMETERS m.nNumericExpression1, m.nBitNumber
>RETURN IIF(m.nBitNumber<=31, BITTEST(m.nNumericExpression1, m.nBitNumber), BITTEST(m.nNumericExpression1/(0x100000000), m.nBitNumber-32))
>RETURN 
>
.
>
>MartinaJ

Martina,

Unfortunately, VFP lacks precision with large numbers.
FOR m.Bit = 32 TO 48
	? m.Bit, VFP64_BITTEST(0x0FFFFFFFFFFFF, m.Bit)
ENDFOR
There is no safe way for doing this in VFP using numeric types, I believe, as Dragan remarked.
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform