I need a function that takes a decimal, with a certain number of digits behiond the comma and convert it to a string with a different number of n digits behind the comma. (to display it)
My problem is the rounding ip/down.
like 123,789 with n = 2 --> 123,79
or 123,4 with n = 0 --> 123
or 123,5 with n = 0 --> 124
I did not find an existing function that does that, so I wrote one myself.
However the code has become soo complex and it still does not work well, and I get frustrated to spend soo much time with something so trivial.
Does anyone know a function that can do this? There must be something out there.
My problem is the rounding ip/down.
like 123,789 with n = 2 --> 123,79
or 123,4 with n = 0 --> 123
or 123,5 with n = 0 --> 124
I did not find an existing function that does that, so I wrote one myself.
However the code has become soo complex and it still does not work well, and I get frustrated to spend soo much time with something so trivial.
Does anyone know a function that can do this? There must be something out there.