View Issue Details

IDProjectCategoryView StatusLast Update
0033439FPCCompilerpublic2019-10-14 08:41
ReporterEduardo Vieira Assigned ToFlorian  
Status resolvedResolutionfixed 
Product Version3.0.4 
Fixed in Version3.1.1 
Summary0033439: Multiply x Currency x Win64
DescriptionWhen I use "FPC -Px86_64 -Twin64 MyProgram" the multiplication does not work using "currency type" with large numbers

By example:

// file cur.pas

Program Cur ;

Var Cur : Currency ;

  Cur:=100000000000 ;
  Cur:=Cur * 7 ;

// The operaction returns "-37869762948.3820" instead of 700000000000

Steps To ReproduceFPC -Px86_64 -Twin64 Cur

Cur [enter]

TagsNo tags attached.
Fixed in Revision38555
Attached Files


has duplicate 0033758 closedYuriy Sydorov Currency bug on Win64 only 
related to 0033755 closedMichael Van Canneyt Update ODBC header function due to problem on Win64 
related to 0036176 closedFlorian Currency multiply by constant (divisible by 10000) on Win64 


Marco van de Voort

2018-03-16 19:29

manager   ~0107162

Seems to 64-bit specific. Works fine 3.0.4 and trunk 32-bit, fails trunk 64-bit (and reported 3.0.4 64-bit)

64-bit arithmetic tries to do it inline and loses precision?


2018-03-17 22:35

administrator   ~0107219

Actually, if you compile with -Co you get an overflow: the multiplication exceeds already the possible range of currency. I implemented a fix for the case given: the constant is divided by 10000 before the multiplication, so the example works, for the general case having a variable with a value of 7, no real fix is possible.

Issue History

Date Modified Username Field Change
2018-03-16 19:18 Eduardo Vieira New Issue
2018-03-16 19:29 Marco van de Voort Note Added: 0107162
2018-03-17 22:35 Florian Fixed in Revision => 38555
2018-03-17 22:35 Florian Note Added: 0107219
2018-03-17 22:35 Florian Status new => resolved
2018-03-17 22:35 Florian Fixed in Version => 3.1.1
2018-03-17 22:35 Florian Resolution open => fixed
2018-03-17 22:35 Florian Assigned To => Florian
2018-05-18 14:46 LacaK Relationship added related to 0033758
2018-05-20 16:58 Yuriy Sydorov Relationship replaced has duplicate 0033758
2018-05-21 09:04 LacaK Relationship added related to 0033755
2019-10-14 08:41 LacaK Relationship added related to 0036176