- Posts: 5
- Thank you received: 0
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
- Topic Author
- Offline
- New Member
Less
More
5 years 1 month ago - 5 years 1 month ago #180525
by JonasHeidelberg
Expression Manager: Why is 123456789012345>=9.58 evaluating to false? was created 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?
The following input:
leads to this output:
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?
The following input:
leads to this output:
Last edit: 5 years 1 month ago by JonasHeidelberg. Reason: rearrange attachements
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5070
- Thank you received: 1263
5 years 1 month ago #180541
by jelo
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Expression Manager: Why is 123456789012345>=9.58 evaluating to false?
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.
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
5 years 1 month ago - 5 years 1 month ago #180553
by DenisChenu
[strike]This must work too with self.NAOK (and you can report) but since have a workaround [/strike]
Still not work
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.
Replied by DenisChenu on topic Expression Manager: Why is 123456789012345>=9.58 evaluating to false?
[strike]Yep, seems to fix the issue[/strike]jelo wrote: So prepare all variables in equation without any textparts.
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")}!
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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
5 years 1 month ago #180569
by JonasHeidelberg
Replied by JonasHeidelberg on topic Expression Manager: Why is 123456789012345>=9.58 evaluating to false?
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.
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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
- Thank you received: 0
5 years 1 month ago #180570
by JonasHeidelberg
Replied by JonasHeidelberg on topic Expression Manager: Why is 123456789012345>=9.58 evaluating to false?
Yes, I only observe this problem with (certain) large numbers.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
5 years 1 month ago #180571
by DenisChenu
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.
Replied by DenisChenu on topic Expression Manager: Why is 123456789012345>=9.58 evaluating to false?
You can report the issue, using self AND replacing self by the equation itself.JonasHeidelberg wrote: Yes, I only observe this problem with (certain) large numbers.
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.