[LON-CAPA-users] (no subject)

Lucas, Mark lucasm at ohio.edu
Mon Nov 2 17:01:35 EST 2015


Rex,

There is a function: roundto(x,n)  available in perl safe space within the coding of a
problem. You might try it to see if it works in the spreadsheet.

$y = &roundto($z,3);

will round z to 3 decimal places.

Later,
Mark


On Nov 2, 2015, at 4:40 PM, Rex Abert <ABERTR at tcc.fl.edu> wrote:

> I have a question about rounding values to, say, 3 or 4 digits in the spreadsheet.  I've come up with the following hack that does the job, but i was wondering if there was a more elegant (built-in?) way to do it.
> 
> 
> $x = &SUMSEQ("T","regexp:Homework")/&SUMSEQ("S","regexp:Homework")*100;
> $x *= 1000;
> $x = int($x);
> $x /= 1000;
> $x; 
> 
> In the above code, columns S and T contain points available and points earned, depending on whether the due date has passed or not.
> 
> Rex Abert
> Associate Professor of Mathematics
> Tallahassee Community College
> _______________________________________________
> LON-CAPA-users mailing list
> LON-CAPA-users at mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-users

-- 
Mark Lucas 								email: lucasm at ohiou.edu
252D Clippinger Lab						phone: (740)597-2984
Department of Physics and Astronomy			fax: (740)593-0433
Ohio University
Athens, OH 45701



More information about the LON-CAPA-users mailing list