Forum > Beginners

Round numbers

(1/1)

hellohello234:
Can someone explain why the decimal numbers won't round? I can't figure it out ://

VTwin:
You did not give enough information, specify your input and output.

g8 is not assigned a value.

Did you look here:
https://www.freepascal.org/docs-html/rtl/system/round.html

jamie:
More than likely it's all those digits that are being displayed! :o

hellohello234:

--- Quote from: VTwin on June 05, 2021, 05:25:18 pm ---You did not give enough information, specify your input and output.

g8 is not assigned a value.

Did you look here:
https://www.freepascal.org/docs-html/rtl/system/round.html

--- End quote ---

Yeah I figured it out hahaa, i meant to put g8:= round(g7) ,, but it still doesn't work :(

Bart:
Define: does not work.
It does not round at all (so 3.14159 stays 3.14159) or you see digits behind the decimal point (3.14159 becomes 3.0000000000000001 or 2.9999999999999).
The latter is because you assign the result to a double and wether or not you see decimals depends on the method you use to display that double.

Bart

Navigation

[0] Message Index

Go to full version