Highlighted

Weird calculation results in Captivate 2017

New Here ,
Jul 09, 2020

Copy link to clipboard

Copied

Hi, Folks

We have conceived a captivate project (Captivate 2017) in which learners get the oppotunity to train their ability to figure out the excact prices of differerent packages of our product.

With 8 differing package constellations given in the shopping cart the learner is asked to type in what she/he assumes as the correct price. Using an advanced action and variables after entering the learne's input will be displayed, the correct price (i.e. the right answer), and the differnce is calculated. (   1. "Your price enty: Euro xxx.xx"  / 2. "The correct price is: Euro xxx_xx" / 3. "You charged Euro xx.xx too much/too little" )

 

Our variable is as follows:

expression    v_difference - v_correct_price - v_customer_x_input 

 

With the learner's input of smooth amounts everything works fine. Even if the difference is 0.50 cents everything is OK. But if the learner enters a price that is by (let's say) 20 cents too much or too little the calculated and displayed differences show a very weird result:

Instead of "You charged 0.20 Euros too much" it says "You charged  0.2999999999999999716 too much".


As it is all a matter of adding or subtract amounts and nothing is divided or so these odd figures are very strange and we have absolutely no guess where the problem stems from. We have already considered a workaround using a java script that would round the calculated difference to only two digits behind the decimal mark (decimal separator). But there must be another solution to this issue.

 

Any qualified suggestions will be very much appreciated. 

Thanks in advance

Tom

Views

41

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Weird calculation results in Captivate 2017

New Here ,
Jul 09, 2020

Copy link to clipboard

Copied

Hi, Folks

We have conceived a captivate project (Captivate 2017) in which learners get the oppotunity to train their ability to figure out the excact prices of differerent packages of our product.

With 8 differing package constellations given in the shopping cart the learner is asked to type in what she/he assumes as the correct price. Using an advanced action and variables after entering the learne's input will be displayed, the correct price (i.e. the right answer), and the differnce is calculated. (   1. "Your price enty: Euro xxx.xx"  / 2. "The correct price is: Euro xxx_xx" / 3. "You charged Euro xx.xx too much/too little" )

 

Our variable is as follows:

expression    v_difference - v_correct_price - v_customer_x_input 

 

With the learner's input of smooth amounts everything works fine. Even if the difference is 0.50 cents everything is OK. But if the learner enters a price that is by (let's say) 20 cents too much or too little the calculated and displayed differences show a very weird result:

Instead of "You charged 0.20 Euros too much" it says "You charged  0.2999999999999999716 too much".


As it is all a matter of adding or subtract amounts and nothing is divided or so these odd figures are very strange and we have absolutely no guess where the problem stems from. We have already considered a workaround using a java script that would round the calculated difference to only two digits behind the decimal mark (decimal separator). But there must be another solution to this issue.

 

Any qualified suggestions will be very much appreciated. 

Thanks in advance

Tom

Views

42

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Most Valuable Participant ,
Jul 09, 2020

Copy link to clipboard

Copied

I have answered yesterday to the same question. Did you post it in the elearning community as well? Remember having posted a link to one of my blog posts where I use JS to format numbers. That will be necessary. Here is that link again:

http://blog.lilybiri.com/percentage-progress-indicator-non-linear-course-solution-2

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Lilybiri LATEST
Most Valuable Participant ,
Jul 09, 2020

Copy link to clipboard

Copied

This is the thread to the first posting of exactly the same question:

https://elearning.adobe.com/2020/07/capivate-2017-calculates-in-a-weird-way/#comment-184311

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Resources
Captivate User Guide
New Group