[fpc-devel] Broken frac function in FPC3.1.1 / Windows x86_64

2018-04-27 Thread info

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.E+020
Runtime error 207 at $00011BD0
  $00011BD0
  $00011614
  $00011696
  $000195D0
  $00011580
  $773D59CD
  $7763383D

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


[fpc-devel] Panel Top Negative Limitation.

2016-02-04 Thread info
Hi
I have a problem using a panel, that is large say 7.
If I try to bring areas of this into the view area by using panel.top:=-avalue, 
this works fine until you hit –32769; at which point the panel vanishes.
How can this be corrected; or is there a workaround?

I have a forum thread; where I have attached simple project demonstrating the 
problem.
http://forum.lazarus.freepascal.org/index.php/topic,31355.msg200797.html#msg200797

Any thoughts appreciated.

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


Re: [fpc-devel] FPC 3.0.0 on OSX 10.6.8 32bit Compile problem

2016-01-18 Thread info

After setting the -Aaa-darwin flag It progresses further, but now stops here

1010) Writing Resource String Table file: uPSRuntime.rsj
:3687:2: error: invalid instruction mnemonic 'fistpq'
  fistpq  (%eax)
   ^~
:8518:2: error: invalid instruction mnemonic 'fistpq'
  fistpq  -12(%ebp)
   ^~
:8936:2: error: invalid instruction mnemonic 'fistpq'
 fistpq  -12(%ebp)
   ^~
:10178:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  -16(%ebp)
   ^~
:10189:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  -16(%ebp)
   ^~
:10200:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  -16(%ebp)
   ^~
:10211:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  -16(%ebp)
   ^~
:10223:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  -16(%ebp)
   ^~
:10232:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  -16(%ebp)
   ^~
:10241:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  -16(%ebp)
   ^~
:10249:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  -16(%ebp)
   ^~
:10257:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  -16(%ebp)
   ^~
:10266:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  -16(%ebp)
   ^~
:10280:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  -16(%ebp)
   ^~
:11146:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%edx)
   ^~
:11372:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%edx)
   ^~
:11549:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%edx)
   ^~
:11983:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%edx)
   ^~
:15014:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%eax)
   ^~
:20147:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%edx)
   ^~
:20162:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%edx)
   ^~
:20177:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%edx)
   ^~
:20192:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%edx)
   ^~
:20206:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%ecx)
   ^~
:20219:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%edx)
   ^~
:20230:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%ecx)
   ^~
:20242:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%ecx)
   ^~
:20254:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%ebx)
   ^~
:20267:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%edx)
   ^~
:20277:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%eax)
   ^~
:20295:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%eax)
   ^~
:21287:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%edx)
   ^~
:21302:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%edx)
   ^~
:21317:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%ecx)
   ^~
:21332:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%edx)
   ^~
:21346:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%ecx)
   ^~
:21359:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%edx)
   ^~
:21370:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%ecx)
   ^~
:21382:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%edx)
   ^~
:21394:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%edx)
   ^~
:21407:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%ecx)
   ^~
:21417:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%eax)
   ^~
:21435:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%eax)
   ^~
:22402:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%eax)
   ^~
:22420:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%eax)
   ^~
:22438:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%eax)
   ^~
:22456:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%eax)
   ^~
:22470:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%ecx)
   ^~
:22486:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%eax)
   ^~
:22497:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%ecx)
   ^~
:22512:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%eax)
   ^~
:22527:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%eax)
   ^~
:22543:2: error: invalid instruction mnemonic 'fistpq'
   fistpq  (%eax)
   ^~

[fpc-devel] FPC 3.0.0 on OSX 10.6.8 32bit Compile problem

2016-01-17 Thread info
Hi

I have been trying to get laz 1.6 rc2 on mac osx 10.6.8, I can instal 1.4.4 FPC 
2.6.4; without problem.
I have run the uninstall script and attempted 1.6rc2, when I try to rebuild 
Lazarus, or add a component that requires a rebuild I get the below error
I have googled fistpq, and found that this is 64bit related.

Any ideas

Josh

Hint: (11030) Start of reading config file /etc/fpc.cfg
Hint: (11031) End of reading config file /etc/fpc.cfg
Free Pascal Compiler version 3.0.0 [2015/11/14] for i386
Copyright (c) 1993-2015 by Florian Klaempfl and others
(1002) Target OS: Darwin for i386
Free Pascal Compiler version 3.0.0 [2015/11/14] for i386
Copyright (c) 1993-2015 by Florian Klaempfl and others
(1002) Target OS: Darwin for i386
(3104) Compiling alllclunits.pp
(3104) Compiling lclproc.pas
:4284:2: error: invalid instruction mnemonic 'fistpq'
fistpq  -12(%ebp)
^~
:4303:2: error: invalid instruction mnemonic 'fistpq'
fistpq  -12(%ebp)
^~
:4326:2: error: invalid instruction mnemonic 'fistpq'
fistpq  -16(%ebp)
^~
:4350:2: error: invalid instruction mnemonic 'fistpq'
fistpq  -16(%ebp)
^~
(9001) Assembling (pipe) /Developer/lazarus/lcl/units/i386-darwin/lclproc.s
lclproc.pas(3221) Fatal: (10026) There were 1 errors compiling module, stopping
Fatal: (1018) Compilation aborted
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] FPC 3.0.0 on OSX 10.6.8 32bit Compile problem

2016-01-17 Thread info

Hi Jonas Maebe,

Yes using the latest xcode for 10.6.8

Sorry to sound stupid, how do I add -Aas-darwin
to the compiler for lazarus so it can rebuild ok.

Josh


Jonas Maebe wrote:

i...@voiceliveeditor.com wrote:

I have been trying to get laz 1.6 rc2 on mac osx 10.6.8, I can instal
1.4.4 FPC 2.6.4; without problem.
I have run the uninstall script and attempted 1.6rc2, when I try to
rebuild Lazarus, or add a component that requires a rebuild I get the
below error
I have googled fistpq, and found that this is 64bit related.


FPC 3.0 switched to using Clang by default as assembler, because the old
assembler is no longer supported with newer Xcode versions. Normally,
that should work fine under Mac OS X 10.6.8 too, as I tested that as
well. In case I missed something, you can switch back to using the old
assembler with the FPC command line parameter -Aas-darwin.


Also, which version of Xcode do you have installed? Have you tried with 
the latest version of Xcode available for Mac OS X 10.6.8? (Xcode 3.2.6, 
IIRC)



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


[fpc-devel] Changed Math functions in FPC development trunk 2.7

2014-04-10 Thread info

A year ago there was a post from Jonas Maebe on this list
(http://www.mail-archive.com/fpc-devel@lists.freepascal.org/msg28483.html)
asking about the possibility to reuse parts of AMath/DAMath in FPC.

Today I downloaded the development source files from
(ftp://ftp.freepascal.org/pub/fpc/snapshot/trunk/source/fpc.zip)
and found very close source code similarity between the changed
(compared with FPC264) math.pp routines and AMath routines.
See the list below.

Although, as Jonas wrote, zlib is compatible with FPC, there is the
need to give references and/or mark the changes. Unfortunately this
is not done.

I am quite sure that these routines are 'inspired' by AMath.
If this is the case, I would appreciate reference to 'AMath by W.Ehrhardt'
or so, as it is done in the FPC264 source for Arjan van Dijk.

Best wishes

Wolfgang Ehrhardt


hypot
---
AMATH
function hypot(x,y: extended): extended;
  {-Return sqrt(x*x + y*y)}
begin
  x := abs(x);
  y := abs(y);
  if xy then hypot := x*sqrt(1.0+sqr(y/x))
  else if x0.0 then hypot := y*sqrt(1.0+sqr(x/y)) {here y = x  0}
  else hypot := y; {here x=0}
end;


FPC-Dev
function hypot(x,y : float) : float;
  begin
x:=abs(x);
y:=abs(y);
if (xy) then
  hypot:=x*sqrt(1.0+sqr(y/x))
else if (x0.0) then
  hypot:=y*sqrt(1.0+sqr(x/y))
else
  hypot:=y;
  end;

FPC 264
function hypot(x,y : float) : float;

  begin
 hypot:=Sqrt(x*x+y*y)
  end;


arcsin and arccos
---
AMATH
function arcsin(x: extended): extended;
  {-Return the inverse circular sine of x, |x| = 1}
begin
  {basic formula arcsin(x) = arctan(x/sqrt(1-x^2))}
  arcsin := arctan2(x, sqrt((1.0-x)*(1.0+x)))
end;

function arccos(x: extended): extended;
  {-Return the inverse circular cosine of x, |x| = 1}
begin
  {basic formula arccos(x) = arctan(sqrt(1-x^2)/x))}
  if abs(x)=1.0 then begin
if x0.0 then arccos := Pi else arccos := 0.0;
  end
  else arccos := arctan2(sqrt((1.0-x)*(1.0+x)),x)
end;

FPC-Dev
function arcsin(x : float) : float;
begin
  arcsin:=arctan2(x,sqrt((1.0-x)*(1.0+x)));
end;

function Arccos(x : Float) : Float;
begin
  if abs(x)=1.0 then
if x0.0 then
  arccos:=Pi
else
  arccos:=0
  else
arccos:=arctan2(sqrt((1.0-x)*(1.0+x)),x);
end;

FPC 264
{ ArcSin and ArcCos from Arjan van Dijk (arjan.vand...@user.metair.wau.nl) }
function arcsin(x : float) : float;
begin
  if abs(x)  1 then InvalidArgument
  else if abs(x)  0.5 then
arcsin := arctan(x/sqrt(1-sqr(x)))
  else
arcsin := sign(x) * (pi*0.5 - arctan(sqrt(1 / sqr(x) - 1)));
end;


function Arccos(x : Float) : Float;
begin
  arccos := pi*0.5 - arcsin(x);
end;


lnxp1 = ln1p
---
AMath (up to V1.74 of 04.Oct.2013, V1.75 introduces an additional branch)

function ln1p(x: extended): extended;
  {-Return ln(1+x), accurate even for x near 0}
var
  y: extended;
const
  x0 = 4.0;
begin
  if x = x0 then ln1p := ln(1.0 + x)
  else begin
y := 1.0 + x;
{The following formula is more accurate than Goldberg [3], Theorem 4. The}
{Taylor series f(x) = f(x0) + (x-x0)*f'(x0) + .. for f(x) = ln(1+x) gives}
{ln1p(x) = ln(1+x0) + (x-x0)/(1+x0) = ln(y) + (x-(y-1))/y, with y = 1+x0.}
if y=1.0 then ln1p := x
else ln1p := ln(y) + (x-(y-1.0))/y;
  end
end;

FPC-Dev
function lnxp1(x : float) : float;
  var
y: float;
  begin
if (x=4.0) then
  lnxp1:=ln(1.0+x)
else
  begin
y:=1.0+x;
if (y=1.0) then
  lnxp1:=x
else
  lnxp1:=ln(y)+(x-(y-1.0))/y;
  end;
  end;

FPC 264
function lnxp1(x : float) : float;
  begin
 if x-1 then
   InvalidArgument;
 lnxp1:=ln(1+x);
  end;






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