Recent

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

SaintMichael57

  • New Member
  • *
  • Posts: 18
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: 36
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

 

TinyPortal © 2005-2018