Various problems with Currency on x86_64
Original Reporter info from Mantis: BrunoK
-
Reporter name:
Original Reporter info from Mantis: BrunoK
- Reporter name:
Description:
x86_64 Erroneous multiplication for large currencies that have a
result that fits in the currency domain. AFAIK correct on i386
2 Problems :
1st Reasonably transtyping Currency to a Int64 and reverse
fails or is wrong.
a) Int64(cCur1) := cInt64HighDiv1E6; // Fails to compile x86_64
b) Int64(vCurRes); // Tanstyping incorrect
2nd Multiplying 2 currency that have a result within the Currency
domain range gives an erroneous result.
Steps to reproduce:
Run joined program on i386 then on trunk x86_64
Additional information:
Results :
CPUi386 FPC 3.0.4 pgmCurrencyInt64Mix_2.exe
-----------------
cCur1=922'337'203.6854
cInt64HighDiv1E6=9223372036854
Int64(vCurRes)=9223376648540018
vCur1=922'337'203.6854 vCur2=1'000.0005 vCurRes=vCur1vCur2=922'337'664'854.0018
vCur1=922337203.6854 vCur2=1000.0005 vCurRes=vCur1vCur2=922337664854.0018
Press enter >
CPUX86_64 FPC 3.3.1 at revision 43682 pgmCurrencyInt64Mix_2.exe
-------------------------------------
cCur1=922'337'203.6854
cInt64HighDiv1E6=9223372036854
vInt64Res=4611685242
vCur1=922'337'203.6854 vCur2=1'000.0005 vCurRes=vCur1vCur2=461'168.5242
vCur1=922337203.6854 vCur2=1000.0005 vCurRes=vCur1vCur2=461168.5242
Press enter >
Mantis conversion info:
- Mantis ID: 36455
- OS: Windows
- OS Build: 10
- Build: 43682
- Platform: x86_64
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 1700 (#a6546a7d)
- Target version: 3.2.0