[fpc-pascal] real to integer

Thomas Miller miller at bio.fsu.edu
Mon May 29 14:46:47 CEST 2006


I am frustrated by a very simple problem.  I am trying to convert  
real to integer, using free pascal for mac.  I am an old Think Pascal  
user who just recently found free pascal and, while thrilled to have  
a pascal compiler for mac OSX,  I am still a bit lost.  In Think  
Pascal, I would have just used "round", but this doesn't seem to work.

x : integer;
y : real;

x := round(y);

gives me an error saying "got "Double" expected "SmallInt"".   This  
occurs no matter how I define x:  integer, smallint, etc.  In fact,  
if I set x to real, then the program compiles and works, simply  
converting decimal values to 0 but not deleting them.

I suspect I am making some simple error.  Any advice?



More information about the fpc-pascal mailing list