[LON-CAPA-dev] Re: [LON-CAPA-users] exponent in formula response

Peter Riegler lon-capa-dev@mail.lon-capa.org
Wed, 03 Feb 2010 16:48:53 +0100


Gerd Kortemeyer wrote:

> While I have not tried it, I suspect that 1/2*10.0^4 would behave differently, since it does not exactly match any of the patterns above.

I have tried this. The behavior is as suspected.

The very reason for the "malfunction" under discussion is the line
# 3x10^8 -> 3&8; 3*10^-8 -> 3&-8
It translates e.g. 1/2*10^2 into 1/2&2 which will eventually become 
1/2e2. In other words 500 becomes 1/200.
Maybe we can fix this with something like
or even

In general I feel uneasy about what we are doing for implicit 
multiplication. In the parlance of theoretical computer science: Are we 
really dealing with a type-3 language here or is it a type-2 language? 
If the latter is true we can't fully solve the issue with finite 
automata/regexes but have to use a parser/stack machine.

Maybe someone can help to think all this through.