Moodle
  1. Moodle
  2. MDL-4595

error in numerical questions with decimal comma

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 1.5.2
    • Fix Version/s: None
    • Component/s: Quiz
    • Labels:
      None
    • Environment:
      All
    • Affected Branches:
      MOODLE_15_STABLE
    • Rank:
      8585

      Description

      Editing a numerical question with a decimal comma as correct result gives wrong result.

      Editing with decimal point, the user can answer with a decimal point or decimal comma and get the correct response.

      It must be possible to edit the right result with comma or point.

        Issue Links

          Activity

          Hide
          Martin Dougiamas added a comment -

          From Gustav Delius (gwd2 at york.ac.uk) Tuesday, 31 January 2006, 06:53 AM:

          See also MDL-3282

          From dialoge dialoge (rh at dialoge.net) Monday, 13 February 2006, 06:18 AM:

          Hi Gustav,

          any idea how to solve it?

          From Gustav Delius (gwd2 at york.ac.uk) Monday, 13 February 2006, 07:26 AM:

          I am afraid I would have to educate myself about this first. I guess it is a question about how PHP converts strings into numbers. If you know something about how PHP can be told to handle decimal commas correctly then please post it here. That will save me some searching.

          From Gustav Delius (gwd2 at york.ac.uk) Monday, 13 February 2006, 08:42 PM:

          Let's discuss this further in MDL-3282.

          From Jeff Forssell (jeff.forssell at cfl.se) Monday, 13 February 2006, 11:29 PM:

          I experimented some to see what (the February stable branch of) Moodle does with this.

          I set: right:3,000.50 unit $

          Found that it

          Accepts: 3.000,50; 3.000,5; 3.000,5$; 3,000,5; 3,000.5

          Rejects: 3.0005; 3 000.5; 3000.5

          I would like the choices: ”strict national” ”generous” with option “accept expressions”

          Strict: 3,000.50 (US) or 3.000,50 (Sweden); etc

          Generous: all strict variants plus “3 000.50” or “3 000,50” (I’d like to add 3,0005E+3 3,0005*10^3 even 3000½)

          Expressions: 3E3+12/2

          I’ve used a numerical tutorial quiz written in PERL to which I added a reg expression filter to process the input string before evaluating it numerically. I’m not sure what numerical formats PHP uses natively but for perl I used:

          , becomes . (this would make problems with thousands separators unless it checked first for both) ^ becomes ** E becomes 10* and even ½ becomes .5 (though it would be good to warn students that it’s not a good idea to use ½.)

          It would be good to have a JavaScript warning when users try to use characters that will make problems (not be understood).

          From Jeff Forssell (jeff.forssell at cfl.se) Tuesday, 28 February 2006, 05:21 PM:

          I noticed that my previous post (which I wrote in an external editor because the page got lost before posting when I was filling directly) had a bunch of characters mangled when I pasted it in here. Now I'm trying UTF-8 rather than ANSI and it seems to work. Time to press [Save], I hope.

          I experimented some to see what (the February stable branch of) Moodle does with this.

          I set: right:3,000.50 unit $

          Found that it

          Accepts: 3.000,50; 3.000,5; 3.000,5$; 3,000,5; 3,000.5

          Rejects: 3.0005; 3 000.5; 3000.5

          I would like the choices: strict national generous with option accept expressions

          Strict: 3,000.50 (US) or 3.000,50 (Sweden); etc

          Generous: all strict variants plus 3 000.50 or 3 000,50 (I'd like to add 3,0005E+3 3,0005*10^3 even 3000½)

          Expressions: 3E3+12/2 sqrt((13/2)^2-(-8))

          I've used a numerical tutorial quiz written in PERL to which I added a reg expression filter to process the input string before evaluating it numerically. I'm not sure what numerical formats PHP uses natively but for perl I used:

          , becomes . (this would make problems with thousands separators unless it checked first for both) ^ becomes ** E becomes 10* and even ½ becomes .5 (though it would be good to warn students that it's not a good idea to use ½.)

          It would be good to have a JavaScript warning when users try to use characters that will make problems (not be understood).

          From Jeff Forssell (jeff.forssell at cfl.se) Tuesday, 28 February 2006, 05:23 PM:

          Still have problems with even ½ becomes .5 (though it would be good to warn students that it's not a good idea to use ½.)

          now I'll try writing it directly: even ½ becomes .5 (though it would be good to warn students that it's not a good idea to use ½

          From Jeff Forssell (jeff.forssell at cfl.se) Tuesday, 28 February 2006, 05:24 PM:

          even that didn't work! the character I'm writing is the one half like 1/2 but as one character.

          Show
          Martin Dougiamas added a comment - From Gustav Delius (gwd2 at york.ac.uk) Tuesday, 31 January 2006, 06:53 AM: See also MDL-3282 From dialoge dialoge (rh at dialoge.net) Monday, 13 February 2006, 06:18 AM: Hi Gustav, any idea how to solve it? From Gustav Delius (gwd2 at york.ac.uk) Monday, 13 February 2006, 07:26 AM: I am afraid I would have to educate myself about this first. I guess it is a question about how PHP converts strings into numbers. If you know something about how PHP can be told to handle decimal commas correctly then please post it here. That will save me some searching. From Gustav Delius (gwd2 at york.ac.uk) Monday, 13 February 2006, 08:42 PM: Let's discuss this further in MDL-3282 . From Jeff Forssell (jeff.forssell at cfl.se) Monday, 13 February 2006, 11:29 PM: I experimented some to see what (the February stable branch of) Moodle does with this. I set: right:3,000.50 unit $ Found that it Accepts: 3.000,50; 3.000,5; 3.000,5$; 3,000,5; 3,000.5 Rejects: 3.0005; 3 000.5; 3000.5 I would like the choices: ”strict national” ”generous” with option “accept expressions” Strict: 3,000.50 (US) or 3.000,50 (Sweden); etc Generous: all strict variants plus “3 000.50” or “3 000,50” (I’d like to add 3,0005E+3 3,0005*10^3 even 3000½) Expressions: 3E3+12/2 I’ve used a numerical tutorial quiz written in PERL to which I added a reg expression filter to process the input string before evaluating it numerically. I’m not sure what numerical formats PHP uses natively but for perl I used: , becomes . (this would make problems with thousands separators unless it checked first for both) ^ becomes ** E becomes 10 * and even ½ becomes .5 (though it would be good to warn students that it’s not a good idea to use ½.) It would be good to have a JavaScript warning when users try to use characters that will make problems (not be understood). From Jeff Forssell (jeff.forssell at cfl.se) Tuesday, 28 February 2006, 05:21 PM: I noticed that my previous post (which I wrote in an external editor because the page got lost before posting when I was filling directly) had a bunch of characters mangled when I pasted it in here. Now I'm trying UTF-8 rather than ANSI and it seems to work. Time to press [Save] , I hope. I experimented some to see what (the February stable branch of) Moodle does with this. I set: right:3,000.50 unit $ Found that it Accepts: 3.000,50; 3.000,5; 3.000,5$; 3,000,5; 3,000.5 Rejects: 3.0005; 3 000.5; 3000.5 I would like the choices: strict national generous with option accept expressions Strict: 3,000.50 (US) or 3.000,50 (Sweden); etc Generous: all strict variants plus 3 000.50 or 3 000,50 (I'd like to add 3,0005E+3 3,0005*10^3 even 3000½) Expressions: 3E3+12/2 sqrt((13/2)^2-(-8)) I've used a numerical tutorial quiz written in PERL to which I added a reg expression filter to process the input string before evaluating it numerically. I'm not sure what numerical formats PHP uses natively but for perl I used: , becomes . (this would make problems with thousands separators unless it checked first for both) ^ becomes ** E becomes 10 * and even ½ becomes .5 (though it would be good to warn students that it's not a good idea to use ½.) It would be good to have a JavaScript warning when users try to use characters that will make problems (not be understood). From Jeff Forssell (jeff.forssell at cfl.se) Tuesday, 28 February 2006, 05:23 PM: Still have problems with even ½ becomes .5 (though it would be good to warn students that it's not a good idea to use ½.) now I'll try writing it directly: even ½ becomes .5 (though it would be good to warn students that it's not a good idea to use ½ From Jeff Forssell (jeff.forssell at cfl.se) Tuesday, 28 February 2006, 05:24 PM: even that didn't work! the character I'm writing is the one half like 1/2 but as one character.
          Hide
          Michael Blake added a comment -

          assign to a valid user

          Show
          Michael Blake added a comment - assign to a valid user

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: