I think you'll be lying on me, but I need help here ...
I have a double (4.5234234) and need it in Int, but each time without numbers after dots. So this does not mean that if his 4.01 or 4.99 he should be 4 in Int.
how to do it?
Have you really tried this?
double myDouble = 4.5234234; int result = (int)myDouble; //at this point result is 4
This will “divide” everything after the decimal point and return only the whole digit in double.
You can use the Math.Truncate method .
Return valueType: System.DoubleThe odd part d; that is, the number that remains after any fractional digits have been discarded.
Return value
Type: System.Double
The odd part d; that is, the number that remains after any fractional digits have been discarded.
, - , ,
double d = 5.555; int a = (int)d;
Convet:
double d = 5.555; int i = Convert.ToInt(d);
Source: https://habr.com/ru/post/1795988/More articles:How to open a link in a pdf file in a new window? - htmlВертикально центрирующий текст в CATextLayer - objective-cCan you set the HTML5 footer to the bottom of the screen on smartphones? - androidWhat is logging and how is Apache Commons logging used? - javaScrolling through folders without recursion - language-agnosticLink to an account in MS Dynamics CRM - c #Как отредактировать mp3 файл, который был загружен в flash через метод fileReference.browse()? - flashOperator Priority - javaОперация системного вызова Mmap, способная получать доступ к ячейкам памяти - cAccess to cs variables inside javascript - javascriptAll Articles