Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BitTest'ing numbers larger then 32 bits
Message
De
01/01/2021 16:39:36
 
 
À
01/01/2021 15:16:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01677684
Message ID:
01677705
Vues:
67
>>
>>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.

Ok, after playing around with Martina's solution, I discovered that you (Antonio) are right. The VFP64_BitTest routine does not provide the results I am looking for. But it does send me in the right direction.
Greg Reichert
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform