Run Code  | API  | Code Wall  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

Learning Rounding and Truncation from the Maths library

Language: Layout:
+ ] Show input
Compilation time: 0.11 sec, absolute running time: 0.08 sec, cpu time: 0.06 sec, average memory usage: 16 Mb, average nr of threads: 4 
edit mode |  history  | discussion
original number: 23.654586

myFloat.ToString(): 23.65459 (default setting is 5 dec places with rounding)

float.ToString("F4"): 23.6546 (has rounding)

converting a truncated string of a float, back to a float number
float.Parse(float.ToString): 23.655

directly rounding off a float number. must include System.Collections class
Math.Round(float,1): 23.7
23

    
                
λ
.NET NoSQL database for rapid development