Rounding down for an arithmetic question

Options
I am curious if anyone knows how to make an arithmetic question in Brightspace where the answer gets rounded down. For example, I am using a variable to describe the length of a workpiece that needs to be made and how many of those workpieces there are. The student has a length of material that is 120" long. So if in the end they can make for example, 34.8 parts, they have to round down because the .8 cannot make an extra part.
Tagged:

Answers

  • Monica.G.541
    Monica.G.541 Posts: 33
    Options

    Hi @Andrew.J.896
    Have you considered using the answer precision option to set it so that the answer should have no decimal places? I think that would get what you are looking for?

    https://community.d2l.com/brightspace/kb/articles/3410-creating-question-library-questions#create-arithmetic-questions

  • Andrew.J.896
    Andrew.J.896 Posts: 3 🔍
    edited June 21
    Options

    Thanks @Monica.G.541 However I think that would still make the answer round up if the calculation happened to end in a 5 or larger. What did work is using the modulo operator function. The % sign is the modulo operator. Here is a good resource on it. https://www.reddit.com/r/learnpython/comments/181ngbk/modulo_operator/ .

    If you had 106" of material and you needed to make workpieces that finish at 5.304" long and for each workpiece cut off the 106" long bar you wasted .0625" (sawing as well as what we call "facing" on both sides of the workpiece so your part has square ends) you could make 19.752 parts. In the real world you could only make 19 parts. So the mod function goes around the clock 19 times and then stops because the interval of one (think of a clock but it only has one hour on it instead of 12 hours) can no longer go a full turn around the clock. So .752 ends up being subtracted from 19.752 to get the final answer of 19. Here is my formulae (and I tested it about 10 times so I think it is good):

    ({L}/({v1}+.0625))-(({L}/({v1}+.0625))%1)

    It is mentioned in the reddit post that MOD is not really a remainder. I think .752 is like an answer, and I subtract that answer from 19.752. One example is if you were facing north and you turned to the right 90 degrees (%90 or MOD90) you would be facing east. So the Mod of 90 gets you East, which is more the answer than a remainder.

    Getting back to my formulae, L is the variable for how long a length of material is (106" in this case), and v1 is how long workpieces will be that will be manufactured out of that material (5.304" in this case). .0625" is how much material is wasted by the width of the saw blade and facing each end on the lathe. In Excel you could just use ROUNDDOWN. However in brightspace it seems you need to do this. Keep in mind the number after the % symbol is 1 because in this case I want the clock to be a one hour clock and go all the way around until 1 cannot go around anymore. So we go from 19.752 to 18.752 to 17.752 to 16.752 to 15.752 to 14.752 to 13.752 to 12.752 to 11.752 to 10.752 to 9.752 to 8.752 to 7.752 to 6.752 to 5.752 to 4.752 to 3.752 to 2.752 to 1.752 to .752 and now the clock cannot go around. So 19.752 mod 1 is( or equals) .752

    10 + 3 mod 12=1 and 19.752 - (19.752 mod 1) =.752

    If anybody thinks any of this is not right please comment!

    Thanks for responding Monica.