- Posts: 6
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Sum is incorrect in Equation question type
- utkb
- Topic Author
- Offline
- New Member
Less
More
2 years 3 months ago #223922
by utkb
Sum is incorrect in Equation question type was created by utkb
Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey Cloud Version 5.2.10
Own server or LimeSurvey hosting: LimeSurvey hosting
Theme: Fruity Theme
==================
Hello,
I want to calculate score of a questionnaire and used Equation quastiontype for this. Each item in this questionnaire have an special weight so I used this equation:
{G12Q61_SQ005.value*22.37+G12Q61_SQ013.value*12.57+G12Q61_SQ022.value*27.26+G12Q61_SQ029.value*16.1+G12Q61_SQ033.value*21.7}
When every value equal to 1, total score must be 100 but result of limesurvey is 100.00000000000001.
What am i doing wrong? Could you help me?
Your LimeSurvey version: LimeSurvey Cloud Version 5.2.10
Own server or LimeSurvey hosting: LimeSurvey hosting
Theme: Fruity Theme
==================
Hello,
I want to calculate score of a questionnaire and used Equation quastiontype for this. Each item in this questionnaire have an special weight so I used this equation:
{G12Q61_SQ005.value*22.37+G12Q61_SQ013.value*12.57+G12Q61_SQ022.value*27.26+G12Q61_SQ029.value*16.1+G12Q61_SQ033.value*21.7}
When every value equal to 1, total score must be 100 but result of limesurvey is 100.00000000000001.
What am i doing wrong? Could you help me?
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12912
- Thank you received: 3975
2 years 3 months ago - 2 years 3 months ago #223949
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Sum is incorrect in Equation question type
Hi,
Why?
This is an issue of floating point arithmetic.
You may read here.
[url] floating-point-gui.de/ [/url]
Joffm
Nothing.What am i doing wrong?
No.Could you help me?
Why?
This is an issue of floating point arithmetic.
You may read here.
[url] floating-point-gui.de/ [/url]
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 2 years 3 months ago by Joffm.
The following user(s) said Thank You: DenisChenu, utkb
The topic has been locked.
- tammo
- Offline
- Official LimeSurvey Partner
Less
More
- Posts: 966
- Thank you received: 219
2 years 3 months ago #223951
by tammo
Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
Replied by tammo on topic Sum is incorrect in Equation question type
Since this is the result of floating point arithmatics, I would round the result like this:
{round((G12Q61_SQ005.value*22.37+G12Q61_SQ013.value*12.57+G12Q61_SQ022.value*27.26+G12Q61_SQ029.value*16.1+G12Q61_SQ033.value*21.7),0)}
{round((G12Q61_SQ005.value*22.37+G12Q61_SQ013.value*12.57+G12Q61_SQ022.value*27.26+G12Q61_SQ029.value*16.1+G12Q61_SQ033.value*21.7),0)}
Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
The following user(s) said Thank You: DenisChenu, utkb
The topic has been locked.
- utkb
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
2 years 3 months ago - 2 years 3 months ago #223953
by utkb
Replied by utkb on topic Sum is incorrect in Equation question type
Thank you very much.
Last edit: 2 years 3 months ago by utkb.
The topic has been locked.
- utkb
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
2 years 3 months ago #223972
by utkb
Replied by utkb on topic Sum is incorrect in Equation question type
We use ,0 as precission so i used 2.Since this is the result of floating point arithmatics, I would round the result like this:
{round((G12Q61_SQ005.value*22.37+G12Q61_SQ013.value*12.57+G12Q61_SQ022.value*27.26+G12Q61_SQ029.value*16.1+G12Q61_SQ033.value*21.7),0)}
The topic has been locked.