Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-19 Thread LacaK



If you find it useful add it please to "tests/test" and/or replace
"tw28748.pp" (as it is subset of this)
Or give mee feedback what should be changed, added or so.


tests/test/cg/taddcurr.pp contains already most of those tests in a
systematic way.


this test was added after FPC 3.0 release ? If yes, then okay. If not
then this test is not sufficient to catch above mentioned bug


No, this test is much older. That test already checks 
adding/subtracting/multiplying and dividing currency values. Your test 
checks the same with integer/double, but that merely adds type 
conversions from double/integer to currency. It's this type conversion 
that is broken in FPC 3.0, and hence that's what should be tested.


Ok, then I have questions:

1. Is there any example of test, which tests others type conversions, 
which I can adapt to currency ?
2. Or is there someone more experienced than me, who is willing write 
such test ?
3. Is it possible at least as temporary solution copy/paste "my tests" 
to tw28748.pp ?


I think, that it is reasonable make steps that will prevent same error 
to raise again in future ...


Thanks
-Laco.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-11 Thread Jonas Maebe

LacaK wrote:

Dňa 11.3.2016 o 14:19 Jonas Maebe napísal(a):

LacaK wrote:

Updated file.
If you find it useful add it please to "tests/test" and/or replace
"tw28748.pp" (as it is subset of this)
Or give mee feedback what should be changed, added or so.


tests/test/cg/taddcurr.pp contains already most of those tests in a
systematic way.


this test was added after FPC 3.0 release ? If yes, then okay. If not
then this test is not sufficient to catch above mentioned bug


No, this test is much older. That test already checks 
adding/subtracting/multiplying and dividing currency values. Your test 
checks the same with integer/double, but that merely adds type 
conversions from double/integer to currency. It's this type conversion 
that is broken in FPC 3.0, and hence that's what should be tested.



Jonas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-11 Thread LacaK

Dňa 11.3.2016 o 14:19 Jonas Maebe napísal(a):

LacaK wrote:

Updated file.
If you find it useful add it please to "tests/test" and/or replace
"tw28748.pp" (as it is subset of this)
Or give mee feedback what should be changed, added or so.


tests/test/cg/taddcurr.pp contains already most of those tests in a 
systematic way.


this test was added after FPC 3.0 release ? If yes, then okay. If not 
then this test is not sufficient to catch above mentioned bug


I think what's may be missing is a systematic test for converting 
currency to floating point types. We already have such tests for 
converting integer types to floating point types in 
tests/test/cg/tcnvint4.pp , but it seems there's no similar test yet 
for converting floating/fixed point types to floating point.


okay, you know better. I leave up to you or somebody more experienced to 
add this tests ... I believe it is not so much work either.


Thanks
-Laco.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-11 Thread Jonas Maebe

LacaK wrote:

Updated file.
If you find it useful add it please to "tests/test" and/or replace
"tw28748.pp" (as it is subset of this)
Or give mee feedback what should be changed, added or so.


tests/test/cg/taddcurr.pp contains already most of those tests in a 
systematic way. I think what's may be missing is a systematic test for 
converting currency to floating point types. We already have such tests 
for converting integer types to floating point types in 
tests/test/cg/tcnvint4.pp , but it seems there's no similar test yet for 
converting floating/fixed point types to floating point.



Jonas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-11 Thread LacaK




> So wouldn't be better have less bigger test units for example 
"tcurrency" which will do complex testing for for example all 
math.operations with currency data type ?

> (as opposed to have lot of fragments in lot of anonymous files)
>

Feel free to write such a test.

See attached file. Is this way or not (may be that somewhat must be 
IFDEFed for platforms where given data type does not exists?) ?
(as I do not know compiler internals, I do not know which makes sense 
to test and which is redundant or irrelevant)


Updated file.
If you find it useful add it please to "tests/test" and/or replace 
"tw28748.pp" (as it is subset of this)

Or give mee feedback what should be changed, added or so.
-Laco.

program tcurrency;

{ test basic mathematical operations (+,-,*,/) using currency data type }

var
  c1, c2: Currency;
  d: Double;
  i: Integer;
  i64: int64;

begin
  writeln('Currency and Double ...');
  // addition double
  d := 1;
  c1 := 2;
  c2 := 3;
  if c1+d <> c2 then begin
writeln('Invalid currency+double=', c1+d, ', but expected ', c2);
halt(1);
  end;
  // subtraction double
  d := 3;
  c1 := 2;
  c2 := -1;
  if c1-d <> c2 then begin
writeln('Invalid currency-double=', c1-d, ', but expected ', c2);
halt(1);
  end;
  // multiplication double
  d := -100;
  c1 := 12.34;
  c2 := -1234;
  if d*c1 <> c2 then begin
writeln('Invalid currency*double=', d*c1, ', but expected ', c2);
halt(1);
  end;
  // division double
  d := 100;
  c1 := 12.34;
  c2 := 0.1234;
  if c1/d <> c2 then begin
writeln('Invalid currency/double=', c1/d, ', but expected ', c2);
halt(1);
  end;

  writeln('Currency and Integer ...');
  // addition integer
  i := 1;
  c1 := 2;
  c2 := 3;
  if c1+i <> c2 then begin
writeln('Invalid currency+integer=', c1+i, ', but expected ', c2);
halt(2);
  end;
  // subtraction integer
  i := 10;
  c1 := -2;
  c2 := -12;
  if c1-i <> c2 then begin
writeln('Invalid currency-integer=', c1-i, ', but expected ', c2);
halt(2);
  end;
  // multiplication integer
  i := 100;
  c1 := 12.34;
  c2 := 1234;
  if i*c1 <> c2 then begin
writeln('Invalid currency*integer=', i*c1, ', but expected ', c2);
halt(2);
  end;
  // division integer
  i := 1000;
  c1 := 123.4;
  c2 := 0.1234;
  if c1/i <> c2 then begin
writeln('Invalid currency/integer=', c1/i, ', but expected ', c2);
halt(2);
  end;

  writeln('Currency and Int64 ...');
  // addition int64
  i64 := 1;
  c1 := 12.3456;
  c2 := 13.3456;
  if c1+i64 <> c2 then begin
writeln('Invalid currency+int64=', c1+i64, ', but expected ', c2);
halt(3);
  end;
  // subtraction int64
  i64 := 100;
  c1 := 12.3456;
  c2 := -87.6544;
  if c1-i64 <> c2 then begin
writeln('Invalid currency-int64=', c1-i64, ', but expected ', c2);
halt(3);
  end;
  // multiplication int64
  i64 := -1;
  c1 := 12.3456;
  c2 := -123456;
  if i64*c1 <> c2 then begin
writeln('Invalid currency*int64=', i64*c1, ', but expected ', c2);
halt(3);
  end;
  // division int64
  i64 := -1;
  c1 := 123456;
  c2 := -12.3456;
  if c1/i64 <> c2 then begin
writeln('Invalid currency/int64=', c1/i64, ', but expected ', c2);
halt(3);
  end;
end.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-10 Thread LacaK

Dňa 11.3.2016 o 8:07 Ondrej Pokorny napísal(a):

On 11.03.2016 7:58, LacaK wrote:




Then that indeed applies for Win64 as well.


Maybe time to start thinking about 3.0.2, then.
This is not a minor bug.



IMO it is serious bug and users should be informed, that upgrading to 
FPC 3.0 (on some platforms) can leads to serious problems when 
currency and double are involved. (but who knows where all around it 
can pop up? ... we know at least about sqlDB, but there may be other 
libraries, components which are affected)


May be we should put warning at: 
http://wiki.freepascal.org/User_Changes_3.0

and
http://wiki.freepascal.org/Lazarus_1.6.0_release_notes


Please update the wiki!


But what is the correct information:

"FPC 3.0 has bug, which causes that mathematical operations involving 
currency and double data types give wrong results on platforms where 
currency is internaly represented as Int64 (f.e. Win64)"

?

-laco.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-10 Thread LacaK


> So wouldn't be better have less bigger test units for example 
"tcurrency" which will do complex testing for for example all 
math.operations with currency data type ?

> (as opposed to have lot of fragments in lot of anonymous files)
>

Feel free to write such a test.

See attached file. Is this way or not (may be that somewhat must be 
IFDEFed for platforms where given data type does not exists?) ?
(as I do not know compiler internals, I do not know which makes sense to 
test and which is redundant or irrelevant)

-Laco.
program tcurrency;

{ test basic mathematical operations using currency data type }

var
  c1, c2: Currency;
  d: Double;
  i: Integer;
  i64: int64;

begin
  writeln('Currency and Double ...');
  // addition double
  d := 1;
  c1 := 2;
  c2 := 3;
  if c1+d <> c2 then begin
writeln('Invalid currency+double=', c1+d, ', but expected ', c2);
halt(1);
  end;
  // multiplication double
  d := 100;
  c1 := 12.34;
  c2 := 1234;
  if d*c1 <> c2 then begin
writeln('Invalid currency*double=', d*c1, ', but expected ', c2);
halt(1);
  end;

  writeln('Currency and Integer ...');
  // addition integer
  i := 1;
  c1 := 2;
  c2 := 3;
  if c1+i <> c2 then begin
writeln('Invalid currency+integer=', c1+i, ', but expected ', c2);
halt(2);
  end;
  // multiplication integer
  i := 100;
  c1 := 12.34;
  c2 := 1234;
  if i*c1 <> c2 then begin
writeln('Invalid currency*integer=', i*c1, ', but expected ', c2);
halt(2);
  end;

  writeln('Currency and Int64 ...');
  // addition int64
  i64 := 1;
  c1 := 12.3456;
  c2 := 13.3456;
  if c1+i64 <> c2 then begin
writeln('Invalid currency+int64=', c1+i64, ', but expected ', c2);
halt(3);
  end;
  // multiplication int64
  i64 := 1;
  c1 := 12.3456;
  c2 := 123456;
  if i64*c1 <> c2 then begin
writeln('Invalid currency*int64=', i64*c1, ', but expected ', c2);
halt(3);
  end;

  readln;
end.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-10 Thread Ondrej Pokorny

On 11.03.2016 7:58, LacaK wrote:




Then that indeed applies for Win64 as well.


Maybe time to start thinking about 3.0.2, then.
This is not a minor bug.



IMO it is serious bug and users should be informed, that upgrading to 
FPC 3.0 (on some platforms) can leads to serious problems when 
currency and double are involved. (but who knows where all around it 
can pop up? ... we know at least about sqlDB, but there may be other 
libraries, components which are affected)


May be we should put warning at: 
http://wiki.freepascal.org/User_Changes_3.0

and
http://wiki.freepascal.org/Lazarus_1.6.0_release_notes


Please update the wiki!

Ondrej
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-10 Thread Sven Barth
Am 11.03.2016 07:52 schrieb "LacaK" :
>
>
>> >
>> >
>> > Are there tests for compiler ?
>> > Is it possible, that such bug is not noticed during preparation of
release ?
>> > (or is it such special case, that this was not covered by existing
test?)
>>
>> There are many and they are run every night for quite some platforms. It
could however be that this specific case was never tested.
>>
>
> As I see there are some test units, which try do complex testing of given
subject (tint, ttrunc, tround etc.) and then there are "ad-hoc" test units
(name begins with "tw"+number), which more or less react only to given bug.
(so until bug is reported no test exists).
> I do not know if there is somebody who really knows what is in these "tw"
test units ? (I doubt that somebody can remember what is in thousand of
files)

We add the examples that are provided on bug reports as tests to avoid
regressions.

> So wouldn't be better have less bigger test units for example "tcurrency"
which will do complex testing for for example all math.operations with
currency data type ?
> (as opposed to have lot of fragments in lot of anonymous files)
>

Feel free to write such a test.

Regards,
Sven
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-10 Thread LacaK




Then that indeed applies for Win64 as well.


Maybe time to start thinking about 3.0.2, then.
This is not a minor bug.



IMO it is serious bug and users should be informed, that upgrading to 
FPC 3.0 (on some platforms) can leads to serious problems when currency 
and double are involved. (but who knows where all around it can pop up? 
... we know at least about sqlDB, but there may be other libraries, 
components which are affected)


May be we should put warning at: http://wiki.freepascal.org/User_Changes_3.0
and
http://wiki.freepascal.org/Lazarus_1.6.0_release_notes

-Laco.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-10 Thread LacaK



>
>
> Are there tests for compiler ?
> Is it possible, that such bug is not noticed during preparation of 
release ?
> (or is it such special case, that this was not covered by existing 
test?)


There are many and they are run every night for quite some platforms. 
It could however be that this specific case was never tested.




As I see there are some test units, which try do complex testing of 
given subject (tint, ttrunc, tround etc.) and then there are "ad-hoc" 
test units (name begins with "tw"+number), which more or less react only 
to given bug. (so until bug is reported no test exists).
I do not know if there is somebody who really knows what is in these 
"tw" test units ? (I doubt that somebody can remember what is in 
thousand of files)


So wouldn't be better have less bigger test units for example 
"tcurrency" which will do complex testing for for example all 
math.operations with currency data type ?

(as opposed to have lot of fragments in lot of anonymous files)

-Laco.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-10 Thread Michael Van Canneyt



On Thu, 10 Mar 2016, Sven Barth wrote:


Am 10.03.2016 18:02 schrieb "Yury Sidorov" :


On 3/10/2016 1:06 PM, Jy V wrote:



This happens only on Win64 with FPC 3.0
Can somebody please check and confirm ?


compiled with official Lazarus 1.6 (SVN revision as displayed in the
about box: 51630)
console output of your program is:

  1.234500E+02* 1.E+002=
1.234500E+08



I've tested FPC trunk on win64 and it works correctly.

 1.234500E+02* 1.E+002=

1.234500E+04


Looks like my fix in r32054 also applies for this case. The bug affected

all targets where currency is 64-bit integer.

Then that indeed applies for Win64 as well.


Maybe time to start thinking about 3.0.2, then.
This is not a minor bug.

Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-10 Thread Sven Barth
Am 10.03.2016 18:02 schrieb "Yury Sidorov" :
>
> On 3/10/2016 1:06 PM, Jy V wrote:
>>
>>
>> This happens only on Win64 with FPC 3.0
>> Can somebody please check and confirm ?
>>
>>
>> compiled with official Lazarus 1.6 (SVN revision as displayed in the
>> about box: 51630)
>> console output of your program is:
>>
>>   1.234500E+02* 1.E+002=
>> 1.234500E+08
>
>
> I've tested FPC trunk on win64 and it works correctly.
>
>  1.234500E+02* 1.E+002=
1.234500E+04
>
> Looks like my fix in r32054 also applies for this case. The bug affected
all targets where currency is 64-bit integer.

Then that indeed applies for Win64 as well.

Regards,
Sven
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-10 Thread Yury Sidorov

On 3/10/2016 1:06 PM, Jy V wrote:


This happens only on Win64 with FPC 3.0
Can somebody please check and confirm ?


compiled with official Lazarus 1.6 (SVN revision as displayed in the
about box: 51630)
console output of your program is:

  1.234500E+02* 1.E+002=
1.234500E+08


I've tested FPC trunk on win64 and it works correctly.

 1.234500E+02* 1.E+002= 
1.234500E+04


Looks like my fix in r32054 also applies for this case. The bug affected 
all targets where currency is 64-bit integer.


Yury.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-10 Thread Mark Morgan Lloyd

LacaK wrote:

Hi,
investigating bug #29760 I reduced bug to:

var
  c: currency;
  d: double;

begin
  c := 123.45;
  d := 100;
  writeln(c, '*', d, '=', c*d); // result of multiply is wrong = 12345
end.

This happens only on Win64 with FPC 3.0

Can somebody please check and confirm ?


Faulty on RPi2 but not on AMD64.

fpc test.pas
Free Pascal Compiler version 3.0.0 [2015/12/25] for arm
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Linux for ARMHF
Compiling test.pas
Assembling program
Linking test
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
11 lines compiled, 1.3 sec
0 1>markMLl@pye-dev-00:~$ ./test
 1.234500E+02* 1.E+002= 
1.234500E+08



fpc test.pas
Free Pascal Compiler version 3.0.1 [2015/08/31] for x86_64
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling test.pas
Linking test
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
10 lines compiled, 0.4 sec
0 1>markMLl@pye-adm-04:~$ ./test.pas
-bash: ./test.pas: Permission denied
126 1>markMLl@pye-adm-04:~$ ./test
 1.234500E+02* 1.E+002= 
1.234500E+04


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-10 Thread Sven Barth
Am 10.03.2016 13:44 schrieb "LacaK" :
>
>
>>
>> This happens only on Win64 with FPC 3.0
>> Can somebody please check and confirm ?
>>
>>
>> compiled with official Lazarus 1.6 (SVN revision as displayed in the
about box: 51630)
>> console output of your program is:
>>
>>  1.234500E+02* 1.E+002=
1.234500E+08
>
>
> Are there tests for compiler ?
> Is it possible, that such bug is not noticed during preparation of
release ?
> (or is it such special case, that this was not covered by existing test?)

There are many and they are run every night for quite some platforms. It
could however be that this specific case was never tested.

Regards,
Sven
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-10 Thread Sven Barth
Am 10.03.2016 13:01 schrieb "Michael Van Canneyt" :
>
>
>
> On Thu, 10 Mar 2016, Yury Sidorov wrote:
>
>> On 3/10/2016 11:33 AM, Michael Van Canneyt wrote:
>>>
>>>
>>> On Thu, 10 Mar 2016, LacaK wrote:
>>>
 Hi,
 investigating bug #29760 I reduced bug to:

 var
  c: currency;
  d: double;

 begin
  c := 123.45;
  d := 100;
  writeln(c, '*', d, '=', c*d); // result of multiply is wrong =
12345
 end.

 This happens only on Win64 with FPC 3.0

 Can somebody please check and confirm ?
>>>
>>>
>>> If confirmed, then I think this is enough reason to start a 3.0.2
>>> release :/
>>
>>
>> I've fixed similar issue for ARM several months ago.
>> http://bugs.freepascal.org/view.php?id=28748
>> But the bug possibly had affected all 64-bit integer currency targets.
>>
>> Does the bug exist in trunk?
>
>
> It really depends on the platform.
>
> Linux, 64-bit prints with trunk:
>
>  1.234500E+02* 1.E+002=
1.234500E+04
>
> And it prints the same with 3.0.0.

It's probably more related to whether the system has Extended or not. On
Linux x86_64 we use the FPU and thus the 80-bit floating point types, on
Win64 we don't. Would be interesting to see the results on other platforms
that don't have an 80-bit type (e.g. ARM).

Regards,
Sven
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-10 Thread Michael Van Canneyt



On Thu, 10 Mar 2016, LacaK wrote:





This happens only on Win64 with FPC 3.0
Can somebody please check and confirm ?


compiled with official Lazarus 1.6 (SVN revision as displayed in the about 
box: 51630)

console output of your program is:

 1.234500E+02* 1.E+002= 
1.234500E+08


Are there tests for compiler ?


Yes, several thousands: a quick count says 5392.
you can find them in the tests directory of the fpc SVN repository.


Is it possible, that such bug is not noticed during preparation of release ?
(or is it such special case, that this was not covered by existing test?)


Presumably the implementation of the currency type predates the testsuite.

Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-10 Thread LacaK




This happens only on Win64 with FPC 3.0
Can somebody please check and confirm ?


compiled with official Lazarus 1.6 (SVN revision as displayed in the 
about box: 51630)

console output of your program is:

 1.234500E+02* 1.E+002= 
1.234500E+08


Are there tests for compiler ?
Is it possible, that such bug is not noticed during preparation of release ?
(or is it such special case, that this was not covered by existing test?)
-Laco.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-10 Thread Michael Van Canneyt



On Thu, 10 Mar 2016, Yury Sidorov wrote:


On 3/10/2016 11:33 AM, Michael Van Canneyt wrote:


On Thu, 10 Mar 2016, LacaK wrote:


Hi,
investigating bug #29760 I reduced bug to:

var
 c: currency;
 d: double;

begin
 c := 123.45;
 d := 100;
 writeln(c, '*', d, '=', c*d); // result of multiply is wrong = 12345
end.

This happens only on Win64 with FPC 3.0

Can somebody please check and confirm ?


If confirmed, then I think this is enough reason to start a 3.0.2
release :/


I've fixed similar issue for ARM several months ago.
http://bugs.freepascal.org/view.php?id=28748
But the bug possibly had affected all 64-bit integer currency targets.

Does the bug exist in trunk?


It really depends on the platform.

Linux, 64-bit prints with trunk:

 1.234500E+02* 1.E+002= 1.234500E+04

And it prints the same with 3.0.0.

Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-10 Thread Jy V
> This happens only on Win64 with FPC 3.0
> Can somebody please check and confirm ?
>

compiled with official Lazarus 1.6 (SVN revision as displayed in the about
box: 51630)
console output of your program is:

 1.234500E+02* 1.E+002= 1.234500E+08
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-10 Thread Yury Sidorov

On 3/10/2016 11:33 AM, Michael Van Canneyt wrote:


On Thu, 10 Mar 2016, LacaK wrote:


Hi,
investigating bug #29760 I reduced bug to:

var
 c: currency;
 d: double;

begin
 c := 123.45;
 d := 100;
 writeln(c, '*', d, '=', c*d); // result of multiply is wrong = 12345
end.

This happens only on Win64 with FPC 3.0

Can somebody please check and confirm ?


If confirmed, then I think this is enough reason to start a 3.0.2
release :/


I've fixed similar issue for ARM several months ago.
http://bugs.freepascal.org/view.php?id=28748
But the bug possibly had affected all 64-bit integer currency targets.

Does the bug exist in trunk?

Yury.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-10 Thread Michael Van Canneyt



On Thu, 10 Mar 2016, LacaK wrote:


Hi,
investigating bug #29760 I reduced bug to:

var
 c: currency;
 d: double;

begin
 c := 123.45;
 d := 100;
 writeln(c, '*', d, '=', c*d); // result of multiply is wrong = 12345
end.

This happens only on Win64 with FPC 3.0

Can somebody please check and confirm ?


If confirmed, then I think this is enough reason to start a 3.0.2 release :/

Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


[fpc-devel] Bug 29760 on FPC 3.0 Win64

2016-03-10 Thread LacaK

Hi,
investigating bug #29760 I reduced bug to:

var
  c: currency;
  d: double;

begin
  c := 123.45;
  d := 100;
  writeln(c, '*', d, '=', c*d); // result of multiply is wrong = 12345
end.

This happens only on Win64 with FPC 3.0

Can somebody please check and confirm ?

Thanks

-Laco.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel