[LON-CAPA-users] (no subject)

Rex Abert ABERTR at tcc.fl.edu
Tue Nov 3 10:08:49 EST 2015

```Peter and Gerd-

Thanks for the suggestions.  Gerd's is a more elegant, one-line version of mine that handles the rounding correctly, where my original version simply chopped the following digits.  In computing a grade average, improperly handling the rounding in the fourth decimal place isn't a huge concern (to me at least---maybe to the student).

Peter's suggestion of "sprintf" also works nicely.  I used

\$x = some formula that computes an average;
sprintf  '%.3f', \$x;

Peter-

After using LC since 2008, and after much begging from students to post their grades, I decided to tackle the spreadsheet.  I was intimidated at first, and the documentation is a bit minimalist, but I've got it figured out.  Like everything else LC, there is a bit of a steep learning curve at first, but the results are well worth it.  The gradebook/spreadsheet works PERFECTLY,  and it is very flexible.  I've been able to incorporate all the offline grades and get students' grade averages computed correctly.

Rex Abert
Associate Professor of Mathematics
Tallahassee Community College
________________________________________
From: lon-capa-users-bounces at mail.lon-capa.org [lon-capa-users-bounces at mail.lon-capa.org] on behalf of Peter Dencker [dencker at math.uni-luebeck.de]
Sent: Monday, November 2, 2015 5:36 PM
To: Discussion list for LON-CAPA users
Subject: Re: [LON-CAPA-users] (no subject)

Hello.

There is the perl builtin  'sprintf '

Does

\$y = sprintf  '%.3f', \$z;

work?

(Could not test it. What is the 'spreadsheet'?)

Peter

On 11/02/2015 11:13 PM, Rex Abert wrote:
> Mark-
>
> I've tried that.  The function &roundto(\$x,\$n) works fine in problem scripts, but returns "undefined" in the spreadsheet.
>
> Rex Abert
> Associate Professor of Mathematics
> Tallahassee Community College
> ________________________________________
> From: lon-capa-users-bounces at mail.lon-capa.org [lon-capa-users-bounces at mail.lon-capa.org] on behalf of Lucas, Mark [lucasm at ohio.edu]
> Sent: Monday, November 2, 2015 5:01 PM
> To: Discussion list for LON-CAPA users
> Subject: Re: [LON-CAPA-users] (no subject)
>
> 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
>
> _______________________________________________
> LON-CAPA-users mailing list
> LON-CAPA-users at mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-users
> _______________________________________________
> LON-CAPA-users mailing list
> LON-CAPA-users at mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-users
>

--
Dr. Peter Dencker
wissenschaftl. Mitarbeiter

UNIVERSITÄT ZU LÜBECK
INSTITUT FÜR MATHEMATIK

Ratzeburger Allee 160
23562 Lübeck

Tel +49 451 500 4254
Fax +49 451 500 3373
dencker at math.uni-luebeck.de

www.math.uni-luebeck.de
_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users at mail.lon-capa.org
http://mail.lon-capa.org/mailman/listinfo/lon-capa-users
```