Page 1 of 1

Ceiling function

PostPosted: Mon Nov 07, 2011 8:17 am

Sometimes there is a need to round to the next whole number, whereas the round function rounds to the number to the nearest whole number. Adding a ceiling function would be helpful in providing the ability to round to the highest whole number.

Kind regards,

Re: Ceiling function

PostPosted: Wed Nov 09, 2011 5:13 pm
by Nav
Hi Rebecca,
We're adding that in our 3.13 enhancement.

The rest doesn't apply to your specific need, but help someone else. Typically, if you're trying to calculate a score, rather than bringing the threshold down from 80 to 0.8, why not raise the score instead? So don't divide by 100, and instead multiply the other side by 100. Or do it at the end.

Let's say you've got 8 total questions, and your score is being counted in a variable called ScoreVar. I would do the following:

Trigger: When quiz is completed
Response: ScoreVar > divide (8) [the total number possible]
Response: ScoreVar > multiply (100)

Trigger: When quiz is completed
Condition: ScoreVar > getValue [greater than or equal to] 80
True Response: Pass feedback > show
False Response: Fail Feedback > show

Let's say your ScoreVar has 7 in it. 7 divided by 8 is 0.875, multiply that by 100, and you get 87.5. That's very easy to compare to 80, and you don't have to worry about decimals. Let's say you've got 6, divide that by 8 and you get 0.75. Multiply that by 100, and you've got 75, again easy to compare with 80.

Not able to open ./cache/data_global.php