Hi,
I need to make a function, that takes as input a double. This should be rounded so it always has a decimal precision of 3:
12.1234 = 12.123
12.1235 = 12.124
12.12 = 12.120
0 = 0.000
Is this possible? The output is going to be written to a file, so it's ok to convert the double to a string and let the function return this string, if it makes the problem easier. Does anybody know a nice and clean way to make this function, or do I need to go ugly??
I need to make a function, that takes as input a double. This should be rounded so it always has a decimal precision of 3:
12.1234 = 12.123
12.1235 = 12.124
12.12 = 12.120
0 = 0.000
Is this possible? The output is going to be written to a file, so it's ok to convert the double to a string and let the function return this string, if it makes the problem easier. Does anybody know a nice and clean way to make this function, or do I need to go ugly??
Comment