Bug with rounding in STACK

Bug with rounding in STACK

ໂດຍ Joel Scott -
ຈຳນວນການຕອບກັບ: 2
So I'm following the documentaton here regarding the formatting of numbers which suggests that using stackfltfmt:"~,2f"; should result in {@float(2/3)@} producing 0.67 but it doesn't, I get 0.66 both in the CasChat and in a question. Similar behaviour for other fractions 7/9  => 0.77 for example.

Am I misunderstanding the docs? Or am I doing it wrong?

ການຈັດອັນດັບສະເລ່ຍ: -
ໃນການຕອບກັບຫາ Joel Scott

Re: Bug with rounding in STACK

ໂດຍ Tim Hunt -
ຮູບພາບຂອງ Core developers ຮູບພາບຂອງ Documentation writers ຮູບພາບຂອງ Particularly helpful Moodlers ຮູບພາບຂອງ Peer reviewers ຮູບພາບຂອງ Plugin developers
You need to read the Maxima documentatoin carefully. I think 'float' is truncating the number, not rounding it. If you want to round the number, you need to use the round function. Only, Maxima users 'Banker's rounding', which is probalby not what you want.

See https://docs.stack-assessment.org/en/CAS/Numbers/#notes-about-numerical-rounding for wht you do want.
ການຈັດອັນດັບສະເລ່ຍ:Useful (1)
ໃນການຕອບກັບຫາ Joel Scott

Re: Bug with rounding in STACK

ໂດຍ Florian Hanisch -
I was fiddling around with different maxima functions a few month ago and arrived at the conclusion, that

significantfigures(number, number of digits)

does ordinary "5 always up" rounding. See also our (a little lengthy) discussion here:

https://moodle.org/mod/forum/discuss.php?d=443018

Best, Florian
ການຈັດອັນດັບສະເລ່ຍ:Useful (1)