[LON-CAPA-users] submission masaging

Peter Riegler lon-capa-users@mail.lon-capa.org
Thu, 17 Jul 2008 21:40:04 +0200

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 

> 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