[LON-CAPA-users] submission masaging

Bob Gonzales lon-capa-users@mail.lon-capa.org
Thu, 17 Jul 2008 16:45:23 -0400


The &implicit_multiplication() doesn't seem to work.  For
a string like "1.1   e-1" it returns "1.1*e-1".  If I use
that in a calculation it becomes the number 1.1 just like
the "1.1   e-1" does.

Also, I'm not using formularesponse or mathresponse, I'm
using numericalresponse but I can't see that it would matter
since Perl is doing the math as you said.

Thank you for the information!

Bob Gonzales
Binghamton University

-----Original Message-----
From: lon-capa-users-admin@mail.lon-capa.org
[mailto:lon-capa-users-admin@mail.lon-capa.org] On Behalf Of Peter Riegler
Sent: Thursday, July 17, 2008 3:40 PM
To: lon-capa-users@mail.lon-capa.org
Subject: Re: [LON-CAPA-users] submission masaging

Hi Bob,

below is a guess what is going on. To give a more reliable answer I would
need to see the source code of the problem.

Bob Gonzales wrote:

> What kind of massaging does LONCAPA do to the string of text that is 
> entered for an answer?
> I ran into a situation where a student entered the number 1.1e-7 as 
> 1.1  e-7.  LONCAPA took out the spaces before it checked the answer 
> and then marked the problem correct.

Presumably, you are using formularesponse or mathresponse. There, prior to
grading the submission is passed through a function named
&implicit_multiplication. Among other things it interprets suitable spaces
as multiplication operators (which is perfectly fine for 1.1<space>e-7).

> I then grabbed the
> submission (via &EXT) and assigned it to a variable and then used the 
> variable in a calculation, without removing spaces (who would have 
> thought...) and got an answer I didn't expect.  Interestingly,  
> LONCAPA used the mantissa (the 1.1 part) in the calculation and 
> ignored the rest of the submission.

Well, this was Perl. Your 1.1 e-7 entered as a string in your calculation,
but within the context of a calculation was converted into a number.
> So, I guess I need to massage the submission the same way LONCAPA does 
> in order to avoid this situation in the future.
Me too. Wrapping an &implicit_multiplication() around the submission should
do it.

Hope this will help

> Thanks,
> Bob Gonzales
> Chemistry Dept
> Binghamton University
> _______________________________________________
> LON-CAPA-users mailing list
> LON-CAPA-users@mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-users

Peter Riegler
Fachhochschule Braunschweig/Wolfenbüttel Salzdahlumer Str. 46/48, 38302
Wolfenbüttel Tel. +49 5331 939 6314, Fax. +49 5331 939 6002
email: p.riegler@fh-wolfenbuettel.de
LON-CAPA-users mailing list