Rounding numbers

Created at 06 Mar 2016, 00:31
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
GD

GDPR-24_203122

Joined 02.10.2015 Blocked

Rounding numbers
06 Mar 2016, 00:31


Is it possible to round decimal numbers, like (14.125) to integers (14), with a simple command, like in C-language there is the "round()" command? 

Or do I need to code it with the volume-rounding? :P

 


Replies

cyfer
06 Mar 2016, 01:47

How to round decimal numbers in C# like you do in C language ?

Print(Math.Round(14.125,0)); //--> Returns a 14  in C#
Print(Math.Round(14.935, 0)); //--> Returns 15

and If you want to Round it so it has some decimal points you can specify that in the 2nd parameter of Round Method .

 


@cyfer

GDPR-24_203122
06 Mar 2016, 10:59

RE:

cyfer said:

How to round decimal numbers in C# like you do in C language ?

Print(Math.Round(14.125,0)); //--> Returns a 14  in C#
Print(Math.Round(14.935, 0)); //--> Returns 15

and If you want to Round it so it has some decimal points you can specify that in the 2nd parameter of Round Method .

 

Thanx!