Lazarus

Free Pascal => Windows => Topic started by: SaintMichael57 on February 27, 2018, 09:05:26 pm

Title: About DIV and ROUND
Post by: SaintMichael57 on February 27, 2018, 09:05:26 pm
Dear FreePascal Community:

Why am I getting the following error messages?

ROUND(Weight);  error: Illegal expression.

(Weight DIV 2) error: Operator not overloaded: "Real" div "shortint"
Title: Re: About DIV and ROUND
Post by: djzepi on February 27, 2018, 09:33:33 pm
Check yours code!

Code: Pascal  [Select]
  1. var
  2.   Weight:double;
  3.   w1,w2:integer;
  4.  
Code: Pascal  [Select]
  1. begin
  2.   // ...
  3.   w1 := round(Weight);
  4.   w2 := w1 div 2;
  5. end;
  6.  

See also
 http://wiki.freepascal.org/Div  (http://wiki.freepascal.org/Div)
 http://wiki.freepascal.org/Round  (http://wiki.freepascal.org/Round)
 http://wiki.freepascal.org/Becomes  (http://wiki.freepascal.org/Becomes)
 http://wiki.freepascal.org/Data_type  (http://wiki.freepascal.org/Data_type)