numbas / Numbas

A completely browser-based e-assessment/e-learning system, with an emphasis on mathematics
http://www.numbas.org.uk
Apache License 2.0
197 stars 118 forks source link

Add a 'number of decimal places' argument to `trunc` #1008

Closed christianp closed 1 year ago

christianp commented 1 year ago

At the moment, trunc(x) rounds towards zero to the nearest integer. It would be convenient to round to a given number of decimal places.

trunc(x, p) should round x towards zero to p decimal places.