Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why not 1*(0.5-0.4-0.1) = 0?
Message
De
07/01/2005 14:06:22
 
 
À
07/01/2005 09:16:06
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Database:
MS SQL Server
Divers
Thread ID:
00974881
Message ID:
00975226
Vues:
40
>>There is some mis-information about BCD & packed decimals. I don't know about mini/mainframe architecture. But in PC, the name is "Binary Coded Decimals" or BCD. There are two types of it, "unpacked BCD" & "packed BCD".
>>
>>Unpacked BCD only consist of one digit per-byte. The lo-byte is for the digit (unsigned), the hi-byte is for other purposes.
>>Packed BCD is two digit per byte, one for each nibble (the lo-byte and the hi-byte). The leftmost digit is for sign.
>
>You are right; BCD can be either packed or unpacked. I had quite forgotten about the details, since I never used them in actual practice.
>
>So, for calculations that are 100% accurate (at least for plus and minus), you have to use BCD - it doesn't matter so much whether it is packed or not.
>
>>Btw, CONGRATULATIONS for you! :-))))
>
>Thanks.

As Jim said, it does matter on Intel platform too. You have to choose which BCD you want to use. packed & unpacked has a specific instruction set to make it different. For instance, an unpacked BCD specifically spare the hi-byte for other purposes. It can contain a multiplier value, etc.. Then you have to use a specific instruction to perform the calculation and maybe we have to make some adjustment (another specific instruction)
Herman
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform