GPC: longreal, how many bits?
Author Message
GPC: longreal, how many bits?

Is there an easy way to find out how many bits there are in the longreal
type in GPC? I am running under RedHat 7.3. The manual, yes, I looked there
first, states that longreal typically occupies 80 bits, but that some
hardware may give you a different length. I am trying to debug a program in
Matlab by running it against one written in GPC and I want to eliminate
precision problems.

John O.

Tue, 22 Nov 2005 00:19:48 GMT
GPC: longreal, how many bits?

Quote:

> Is there an easy way to find out how many bits there are in the longreal
> type in GPC? I am running under RedHat 7.3. The manual, yes, I looked there
> first, states that longreal typically occupies 80 bits, but that some
> hardware may give you a different length. I am trying to debug a program in
> Matlab by running it against one written in GPC and I want to eliminate
> precision problems.

Try sizeof(longreal), if it is 10, it is 80 bits :-)

I assume it will be 80-bit on x86 always (since 80-bit is a x86 specific
hardware type), and the remark probably is meant for non-x86 systems.

Tue, 22 Nov 2005 18:33:45 GMT
GPC: longreal, how many bits?
If you're mean how many bits it takes in ram to store longreal,try
writeln('longreal size=',sizeof(longreal)); - as Marco van de Voort
said

If you're interesting,how many SIGNIFICANT bits it contains(how many
precisious)
,this value may vary for different processors(!),
try

var r,t:extended;n:longint;
begin
Writeln('longreal reqres ',sizeof(longreal)*8,' bits of storage');
r:=1.0;
for n:=1 to 255 do
begin
r:=r/2;
t:=r+1;{to prevent "optimisation"!}
if t=1 then begin
Writeln('longreal have ',n,' significant matissa{don''t sure in
grammatics}bits(and have some exponent part bits)');
Break;
end;
end;
end.
I have 80 bits to store and 64 matissa bits.

-main idea is division r by 2 until 1+r will be eqal to 1.
{sometimes it may NEWER be eqal by "fcomp" instruction or
optimisation}
But some instructions is less precise that another,and,this walue is a
maximal precise of addition.Division,log2, etc. have lesser precise.

IMHO,you newer need more precise that real.
No one meansured phisical constants(G,C,e(electron charge),etc) with
this precise)

Regards,

Dmytry Lavrov.
http://dmytrylavrov.narod.ru

Tue, 22 Nov 2005 20:44:57 GMT

 Page 1 of 1 [ 3 post ]

Relevant Pages