Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Expression Manager: Why is 123456789012345>=9.58 evaluating to false?

  • JonasHeidelberg
  • JonasHeidelberg's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 1 month ago - 5 years 1 month ago #180525 by JonasHeidelberg
I am creating a quiz where users should answer questions (e.g. which year was XYZ born) by giving a range (min, max). I then want to check if the true answer was within that range.
When testing it, it seems that LimeSurvey has a problem with large numbers:
100000000000000>=9.58 works (gives true)
130000000000000>=9.58 works (gives true)
123456789012345>=9.58 DOES NOT WORK (gives false) - see attached .lss and attached screenshots.

Any ideas where this is coming from? I can see that the input numbers are stored correctly in the results, just the comparison seems to fail...??? Anything I can do about this? Does anyone know what exactly is triggering this?

File Attachment:

File Name: limesurvey...6986.lss
File Size:36 KB


The following input:

leads to this output:
Last edit: 5 years 1 month ago by JonasHeidelberg. Reason: rearrange attachements
The topic has been locked.
More
5 years 1 month ago #180541 by jelo
Only took a quick look.
Please separate the calculation of the values from the rest.
When an equation question is containing HTML parts the equation questioncode cannot be used as a variable for EM. The equation variable is no longer a clean number, but often contains HTML fragments. That somestimes work, but often is causing chaos.

So prepare all variables in equation without any textparts.


This here seems to reference itself.

If you still have issues, please state what LimeSurvey version is uses and what PHP version is running LimeSurvey.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Attachments:
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 1 month ago - 5 years 1 month ago #180553 by DenisChenu

jelo wrote: So prepare all variables in equation without any textparts.

[strike]Yep, seems to fix the issue[/strike]
Code:
So you believe the true answer for Q3 is between {array1_SQ003_SQMin} and {array1_SQ003_SQMax}? This is {if(((!is_empty(array1_SQ003_SQMax.NAOK)) and (!is_empty(array1_SQ003_SQMin.NAOK))),"true, congratulations","false, I am sorry")}!
[strike]This must work too with self.NAOK (and you can report) but since have a workaround :)[/strike]

Still not work
Code:
So you believe the true answer for Q3 is between {array1_SQ003_SQMin} and {array1_SQ003_SQMax}? This is {if(array1_SQ003_SQMin<=18.9 and array1_SQ003_SQMax>=18.9,"true, congratulations","false, I am sorry")}!

Maybe because it's big number ?

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 5 years 1 month ago by DenisChenu.
The topic has been locked.
  • JonasHeidelberg
  • JonasHeidelberg's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 1 month ago #180569 by JonasHeidelberg
Hi jelo,
I am not sure what you want me to do differently. The actual equation (which gets stored in the database) evaluates to true or false, and only the question which is displayed contains HTML:


From what I understand the self.NAOK should refer to the true/false in the equation, not to the question text. Or am I mistaken?I should stress that for smaller "Max" values all works fine...

I use PHP version 7 and LimeSurvey Version 3.15.8+190130.
The topic has been locked.
  • JonasHeidelberg
  • JonasHeidelberg's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 1 month ago #180570 by JonasHeidelberg
Yes, I only observe this problem with (certain) large numbers.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 1 month ago #180571 by DenisChenu

JonasHeidelberg wrote: Yes, I only observe this problem with (certain) large numbers.

You can report the issue, using self AND replacing self by the equation itself.

With the equation itself : no JS
Without : there are a span wrapper

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose