Interesting bug in German version re decimals in expressions

12 views
Skip to first unread message

Julia Goedecke

unread,
Nov 12, 2021, 7:10:50 AM11/12/21
to Numbas Users
Hello,
I've found an interesting bug in the German version of Numbas:
if you have a variable x with value say 1.5, and you then make an
expression using this variable, say expression("{x}y"), then it reads
the value into the string as 1,5 (as that's how decimals are written in
German), but then it thinks there is a tuple there rather than a
decimal, and gives an error.

Julia
--
www.julia-goedecke.de

Julia Goedecke

unread,
Nov 12, 2021, 7:50:15 AM11/12/21
to Numbas Users
PS: I made it work as expression("parsedecimal("{x}","eu")y").

Makes the codes for the variables a lot more complicated, but it works :-)

Julia

Christian Lawson-Perfect

unread,
Nov 16, 2021, 3:03:38 AM11/16/21
to numbas...@googlegroups.com
This is indeed an interesting problem. I've been wondering what to do about it for a while: ideally, I'd like to be able to accept non-English styles of number notation in the "mathematical expression" part, and so in JME code, but I'm not sure how to go about doing it.
I don't think globally changing the JME syntax to use comma for decimal separator is safe to do - there's a lot of built-in stuff, particularly in the built-in marking algorithms, that would break. The code to substitute into curly braces in strings can't currently tell if it's inside an expression() call, but maybe if it could then that would fix this problem. I'll have a think.

--
You received this message because you are subscribed to the Google Groups "Numbas Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numbas-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/numbas-users/2b136d9a-a7da-294c-3529-029668eb1186%40cantab.net.
Reply all
Reply to author
Forward
0 new messages