Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2001-10

bug?

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Jan Feitsma

Hello

I think i've found a problem with respect to big integers (int64,qword types). Please look at the following testprogram and tell me if there's a patch. I'm using fpc version 1.0.4 on Win32.

program Bugtest(input,output);
var
   big : int64;
function intpower(b,p : longint) : int64;
var i : longint;
begin
   intpower:=1;
   for i:=1 to p do intpower:=b*intpower;
end;
begin { main }
   big := 4294967296;   { =2^32 }
   writeln(' 2^32=',big);
   writeln(' 2^32=',intpower(2,32));
end.

This program gives the following output:

2^32=0
2^32=4294967296

Apparently something has gone wrong putting
the value 2^32 into 'big'

Please help me!

Greetings Jan Feitsma

Reply by email

Peter Vreman
Show quoted text 34 lines
Hello I think i've found a problem with respect to big integers (int64,qword types). Please look at the following testprogram and tell me if there's a patch. I'm using fpc version 1.0.4 on Win32. program Bugtest(input,output); var big : int64; function intpower(b,p : longint) : int64; var i : longint; begin intpower:=1; for i:=1 to p do intpower:=b*intpower; end; begin { main } big := 4294967296; { =2^32 } writeln(' 2^32=',big); writeln(' 2^32=',intpower(2,32)); end. This program gives the following output: 2^32=0 2^32=4294967296 Apparently something has gone wrong putting the value 2^32 into 'big' Please help me!

Try a 1.1 development snapshot. The 1.1 development series supports constant values larger than maxlongint better

Reply by email

Jonas Maebe
to Jan Feitsma: Hello I think i've found a problem with respect to big integers (int64,qword types).…
Jan Feitsma wrote
program Bugtest(input,output); var    big : int64;

[snip]

  begin { main }    big := 4294967296;   { =2^32 }

The problem is that 1.0.x only supports 32bit constants. The current 1.0.5 gives an error on this line:

bugtest.pp(13,11) Error: Incompatible types: got "S80REAL" expected
"INT64"

In 1.1, support for 64 bit constants has been added and there your program works correctly.

Jonas

Reply by email