Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey 3.0
Own server or LimeSurvey hosting:
Theme: test_theme
==================
Hello,
I am trying to round numbers with just one real decimal and the last digit being zero. For example, when the number is "29.2869" is supposed to be rounded to "29,30" or when "29.0156" to "29,00". This rounding is only required when unit 3 is selected among three options. The variable Q1 is produced by multiplying a number determined by the participant and another randomly chosen number among 100 options, but is coded in another part.The code I use for rounding is as follows:
{if(Unit == 1, round(Q1*52*Hours,0), if(Unit == 2, round(Q1*4.33*Hours,0),(if(strpos(fixnum(round(Q1,1)),'.') == strlen(fixnum(round(Q1,1)))-2, join(fixnum(round(Q,1)),',00'), join(fixnum(round(Q1,1)), '0')))))} {Unit.shown}
It works perfectly fine when the number is two-digit in any case. It also works for one-digit and three-digit when the last digit is not zero. However, when the number is three-digit and rounded with the first decimal zero, it does not work. For example, for "101.0106" it gives an output of "1010". And also for one-digit, I face a very similar problem. For example when the number is "9.8023", it produces an output of "9,8,00".
I really cannot find a way to solve this problem.
I will appreciate if you could help.
The topic has been locked.