no decimal places

Posted By: DLively

no decimal places - 04/30/14 04:01

Hello laugh


I would like to know how to tell the engine, that if a variable has a deciamal place to round to the lowest number?

is there a simple code to do this? :?
Posted By: Amanda_Dearheart

Re: no decimal places - 04/30/14 05:32

Im not sure about A8's implementation of lite c, but c++ has instructions for rounding numbers named round, floor, ceil, and trunc.

im unsure what round and trunc does, but floor always round down while ceil always round up.
Posted By: DLively

Re: no decimal places - 04/30/14 06:27

Thanks Amanda, Ill look into the manual with that new information laugh
Posted By: DLively

Re: no decimal places - 04/30/14 06:31

okay, so I already knew this one laugh

floor()
Posted By: WretchedSid

Re: no decimal places - 04/30/14 17:53

Originally Posted By: Amanda_Dearheart
im unsure what round and trunc does

round() rounds to the nearest integer in halfway cases.
trunc() rounds to the nearest integer that is not greater in magnitude than the input.
© 2024 lite-C Forums