English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Ex :
3.4578909234 become 3.458
5.6746 become 5.675
can somebody help me..
please..
thank in advanced..

2007-09-27 05:38:50 · 2 answers · asked by xXx 1 in Computers & Internet Programming & Design

2 answers

Multiply it by 1,000, add 0.5, and truncate it to an integer. Then divide by 1,000:

((int)(1000.0 * someValue + 0.5)) / 1000.0

2007-09-27 05:47:42 · answer #1 · answered by McFate 7 · 1 0

use round() function in math.h

2007-09-27 20:35:54 · answer #2 · answered by i_am_the_next_best_one 5 · 0 0

fedest.com, questions and answers