Skip to main content
Stagprime2687219
Legend
December 6, 2017
Answered

Bug Report

  • December 6, 2017
  • 2 replies
  • 1182 views

I believe I have discovered a bug in Captivate v9.0.2.437

A little background...

I was tinkering with an idea where the user can manipulate various settings that are used to determine the capacity of a scale.

The numbers across the top are called graduations, the left side represents the decimal place location, and the right side represents the size of the increment.

In essence, the math is simple - the increment and decimal location are multiplied together to create the "count-by". This is then multiplied by the number of graduations to create the capacity. The default in this scenario is 10000 graduations with a count-by of 1. This means the scale would count up 1, 2, 3, 4, 5, etc.

The user can select the various choices provided. Each selection assigns the appropriate value to a variable and calculates the capacity and displays it in the window of the scale weight indicator. The idea is for the learner to simply play with the combinations and see their relationship to one another to help develop understanding.

Now the bug part.

In the video, you can see me go through several selections but for some reason, the combination of 4 decimal places, 7000 graduations, and 1 or 2 divisions creates a lot more zeroes when the calculation is performed. I placed a few text boxes on top to show the variables being updated. The two values at left are simply multiplied together to come up with the value on the right using an expression. The expression works fine with all the other combinations.
Unfortunately, I don't see anything I can do on my end to correct this...

    This topic has been closed for replies.
    Correct answer TLCMediaDesign

    Well in JavaScript 7000 * 0.0001 = 0.7000000000000001

    So I don't see this as being a bug if Captivate is using JavaScript to do the calculation.

    The issue is with floating point decimals an mapping them to a binary representation.

    If you want this to work correctly you are going to need to use JavaScript yourself to do the calculations and either round or use fixed decimal places.

    I don't know how you are doing the calculations, if in an advance action or not, But even if you are using an advanced action you could always add this simple JavaScript as the last step.

    window.yourVariableName = Number(window.yourVariableName).toFixed(1);

    or

    window.yourVariableName.toFixed(1)

    2 replies

    TLCMediaDesign
    Inspiring
    December 7, 2017

    What are the calculations you are using to get the value with all of the zeros?

    It might be beneficial to use JavaScript, Captivate is doing that anyway, so you can control the rounding of values or to display a fixed amount of decimal places

    Stagprime2687219
    Legend
    December 7, 2017

    It is just varC = varA * varB

    You can see the numbers at the top in the video being multiplied together.

    The only issue is with 7000 * 0.0001  and  7000 * 0.0002

    All the others work fine.

    TLCMediaDesign
    TLCMediaDesignCorrect answer
    Inspiring
    December 7, 2017

    Well in JavaScript 7000 * 0.0001 = 0.7000000000000001

    So I don't see this as being a bug if Captivate is using JavaScript to do the calculation.

    The issue is with floating point decimals an mapping them to a binary representation.

    If you want this to work correctly you are going to need to use JavaScript yourself to do the calculations and either round or use fixed decimal places.

    I don't know how you are doing the calculations, if in an advance action or not, But even if you are using an advanced action you could always add this simple JavaScript as the last step.

    window.yourVariableName = Number(window.yourVariableName).toFixed(1);

    or

    window.yourVariableName.toFixed(1)

    RodWard
    Community Expert
    Community Expert
    December 7, 2017

    If you believe this to be a bug, you should really be reporting it using the Bug Reporting form linked to the Captivate Community page.  Opening a thread here on the User Forum doesn't do the same thing.  However, the thread might allow someone to suggest a workaround you can use.

    Stagprime2687219
    Legend
    December 7, 2017

    I did follow up later with a formal report.