moodle-qtype_formulas icon indicating copy to clipboard operation
moodle-qtype_formulas copied to clipboard

Formatted output of numbers, e.g. with scientific notation

Open FloMiLe opened this issue 6 months ago • 0 comments

Description of proposed feature

It would be very helpful to have a function that allows for formatted output of numbers (e.g. in the feedback fields), especially in scientific notation.

How can the new feature be used?

I only give examples of possible function names, but the could, of course, also be totally different.

A function str_scinot(1234) (think "scientific notation") would return the string 1.234e3.

A function str_mant(1234) (think "mantissa") would return the string 1.234.

A function str_ordmag(1234) (think "order of magnitude") would return the string 3.

Additional comments

Let me know if it would be helpful at all if I created code snippets for these functions as in https://github.com/FormulasQuestion/moodle-qtype_formulas/issues/61

FloMiLe avatar Jun 26 '25 20:06 FloMiLe