Louie De Janeiru

Decimal point handling 본문

C#

Decimal point handling

Louiey 2019. 9. 23. 11:08

double doubleValue = 0.12345

 

Math.Ceiling(doubleValue); // 올림

Math.Round(doubleValue); // 반올림

Math.Truncate(doubleValue); // 버림

 

Math.Truncate(doubleValue * 10) / 10; // 소수점 첫째 버림

Math.Truncate(doubleValue * 100) / 100; // 소수점 둘째 버림

Math.Truncate(doubleValue * 1000) / 1000; // 소수점 셋째 버림

'C#' 카테고리의 다른 글

Screen Record  (0) 2020.09.16
Properties.Settings.Default  (0) 2019.09.24
DataGridView double buffered enable  (0) 2019.06.12
Textbox에 숫자만 입력받기  (0) 2019.02.11
TextBox text null check  (0) 2018.11.13