Hi
I am trying to compile mparith on a number of different computers.
It appears that mparith is still available here
https://web.archive.org/web/20190729022124/http://www.wolfgang-ehrhardt.de:80/misc_en.html#mparith(Wolfgang passed away June 2019)
I'm on fpc3.20.
On 64 bit Intel Linux and Windows it compiles fine.
On 64 bit ARM I am having some trouble.
The trouble starts on line 513 of std.inc
{$ifdef CPUARM}
{$define EXT64} {No extended for ARM}
{$define PurePascal}
{$endif}
There is also this comment
1.59 06.05.14 we FPC/CPUARM: $define EXT64, i.e. no FP 80-bit extended
Then line 1408 of mp_base.pas
{$ifndef EXT64}
{---------------------------------------------------------------------------}
procedure frexpx(x: extended; var m: extended; var e: longint);
{-Return the mantissa m and exponent e of x with x = m*2^e, 0.5 <= abs(m) < 1;}
{ if x is 0, +-INF, NaN or denormal, return m=x, e=0}
begin
e := TMPHexExtW(x)[4] and $7FFF;
{First check is INF or NAN, then if x is zero/denormal}
if (e=$7FFF) or (e=0) or (x=0.0) then e := 0
else begin
dec(e,$3FFE);
TMPHexExtW(x)[4] := (TMPHexExtW(x)[4] and $8000) or $3FFE;
end;
m := x;
end;
On Intel this function isn't used, but on ARM 64 bit it won't compile line 1414
e := TMPHexExtW(x)[4] and $7FFF;
The error is Illegal type conversion: "Double" to "TMPHexExtW"
I have previously compiled this code with an older version of FPC on 32 bit ARM (Raspbian) so I'm guessing it's a problem with stricter type checking in 3.20 ?
The problem is that I don't understand the "extended" part of TMPHexExtW(x)[4]
This is the definition
type
TMPHexExtW = packed array[0..4] of word; {Extended as array of word}
What does the "extended" and the x mean or do? I don't understand.
Is "extended" in the context of an array related to "extended" in the context of an ARM processor? or is it the same word for two different things?
thanks, DNJ