Changes to Round Variable and Calculation coding?

I used to have a problem when using the "Round Variable" function and running the course in IE (I believe the IE we used at the time defaulted to Quirks Mode) (link to old thread: http://lectora.com/forum/showthread.php?t=12553). I've also noticed that calculations terminate after 2 decimal points (2/3= .66 instead of .66666666... or .67). I'm not experiencing the same problem now, but I believe it's a combination of new IE (now I'm testing in IE 9, but even reverted to IE 7 it's working), and new coding for these calculations on the Lectora end.


Can someone explain the code for the round variable function, and confirm that calculations are limited to 2 decimal points? If the latter is true, is there a way to edit the number of decimal points that are returned, or adjust the result to more accurately reflect the calculation (2/3 really should be .67 if limited to 2 decimal points...)?


Thanks in advance :)

Discussion (4)

I'm not sure this is helpful, but I did run into problems due to Lectora rounding errors. I ended up writing my own functions in JavaScript to perform the calculations I needed.

@ssneg 57086 wrote:

I'm not sure this is helpful, but I did run into problems due to Lectora rounding errors. I ended up writing my own functions in JavaScript to perform the calculations I needed.


When did you have errors, and what kind of errors did you have? What version of Lectora, and of IE?


That's how I got around the errors I used to have, but I couldn't recreate the problem in Lectora 11/IE7+...

@NixTheNext 57088 wrote:

When did you have errors, and what kind of errors did you have? What version of Lectora, and of IE?


That's how I got around the errors I used to have, but I couldn't recreate the problem in Lectora 11/IE7+...



Definitely Lectora X, not 11. Any browser. I was trying to calculate the number of correct answers based on score and total number of questions (obvious: correctAnswers = totalQuestions * Score / 100) but it came up wrong because Lectora always rounded down instead of rounding down/up mathematically for some reason.

yes, Lectora is limited to 2 dec places. You can get higher precision by multiplying first and then dividing but you cannot get more than 2 dec places in your display. I have not had any trouble rounding. It seemed to work fine on some simple calcs. I have used both regular Round and Round Down. If you have a simple page, you can extract to a new title, zip and send to me at the below.

Discussions have been disabled for this post