Hi Rodrigo,
I'd like to draw your attention to the following documenation page:
https://github.com/maths/moodle-qtype_stack/blob/master/doc/en/CAS/Numbers.md
You might want to pay special attention to the paragraphs titled "Maxima and floats with trailing zeros".
I was not able to preserve trailing zeros with any input type through further operations / calculations. This might only apply to
The next best thing you can do is string manipulation and evaluation. Let x,y be your students input (input type should be "String"):
xdec: split(x,".");
xlen: length(split(xdec[2], ""));
ydec: split(y,".");
ylen: length(split(ydec[2], ""));
diff: xlen - ylen;
The first line splits the input string at the delimiter "." (decimal point).
The second line then takes the second part of this split operation (the right-hand side or decimal places) and takes an empty delimiter for the split operation, giving single characters. The length of the resulting array is the number of decimal places in your input. You can then simply compare whether diff equals zero.
Cheers
I'd like to draw your attention to the following documenation page:
https://github.com/maths/moodle-qtype_stack/blob/master/doc/en/CAS/Numbers.md
You might want to pay special attention to the paragraphs titled "Maxima and floats with trailing zeros".
I was not able to preserve trailing zeros with any input type through further operations / calculations. This might only apply to
The next best thing you can do is string manipulation and evaluation. Let x,y be your students input (input type should be "String"):
xdec: split(x,".");
xlen: length(split(xdec[2], ""));
ydec: split(y,".");
ylen: length(split(ydec[2], ""));
diff: xlen - ylen;
The first line splits the input string at the delimiter "." (decimal point).
The second line then takes the second part of this split operation (the right-hand side or decimal places) and takes an empty delimiter for the split operation, giving single characters. The length of the resulting array is the number of decimal places in your input. You can then simply compare whether diff equals zero.
Cheers