* * *

Author Topic: About DIV and ROUND  (Read 722 times)

SaintMichael57

  • New member
  • *
  • Posts: 17
About DIV and ROUND
« 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"

djzepi

  • New member
  • *
  • Posts: 35
Re: About DIV and ROUND
« Reply #1 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/Round
http://wiki.freepascal.org/Becomes
http://wiki.freepascal.org/Data_type

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus