Turbo Pascal 1.5

Long time since I've used Pascal, but IIRC round(x) would round up or down to the nearest integer and trunc(x) would strip off any decimal points (so always rounding down).
 
A long time for me too...

I vaguely recall that round() returns an integer, so won't necessarily do what you expect if your real type variable is outside the integer range of <32768 or >32767.

1.00000000E1 is already a whole number (10) but shown in exponential notation. If you're just trying to display it as a rounded whole number can you not use formatting in a writeln statement? (Something like writeln(x:1:0)? I forget the detail :()

Of course if the variable is intended to only hold whole numbers then it shouldn't have been declared as a 'real' type in the first place.
 
Back
Top Bottom