If you compile and run this 64-bit program on Win 64 you get a crash

program tfrac;
var
  x,y: double;
begin
  x := 1e20;
  writeln('x=',x);
  y := frac(x);
  writeln('frac(x)=',y);
end.

D:\Work\DAMath>D:\FPC311\bin\i386-win32\ppcrossx64.exe tfrac.pas
Free Pascal Compiler version 3.1.1-r20:38794 [2018/04/22] for x86_64
Copyright (c) 1993-2018 by Florian Klaempfl and others
Target OS: Win64 for x64
Compiling tfrac.pas
Linking tfrac.exe
9 lines compiled, 0.1 sec, 37472 bytes code, 2036 bytes data

D:\Work\DAMath>tfrac
x= 1.0000000000000000E+020
Runtime error 207 at $0000000100001BD0
  $0000000100001BD0
  $0000000100001614
  $0000000100001696
  $00000001000095D0
  $0000000100001580
  $00000000773D59CD
  $000000007763383D

I recently posted an issue to the bugtracker

https://bugs.freepascal.org/view.php?id=33635

But the only responses are by a reporter named Thaddy de Koning, which
are for me totally useless and IMO he did miss the point.

Are there changes to the frac function (or its documentation) in the
newer 64-bit windows cross-compiler? Especially for the allowed ranges?

This would not be intuitive because the corresponding int function works as
expected, and meanwhile I use the work-around  frac(x) := int(x) -x

Wolfgang Ehrhardt

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

Reply via email to