Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-8473 Numerical question: bugs and improvements
  3. MDL-8478

Small numerical naswers i.e. 1e-18 are not graded correctly

    XMLWordPrintable

Details

    • Sub-task
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.8
    • None
    • Questions
    • None
    • MOODLE_18_STABLE

    Description

      When the answer is a small number i.e 1e-19 as the charge of the electron the range of the allowed answer can extend to negative value given the fact that the code of add +- a small number
      line 355 of numerical/questiontype.php in the function get_tolerance_interval(&$answer) {
      // We need to add a tiny fraction depending on the set precision to make the
      // comparison work correctly. Otherwise seemingly equal values can yield
      // false. (fixes bug #3225)
      $tolerance = (float)$answer->tolerance + ("1.0e-".ini_get('precision'));
      This is to remediate for the 0.000000001 or .999999999 possible output of real number functions.
      So if the user put an answer like 1.6e-5 php code could sometimes see it 0.0000159999999 or 0.00001600000001
      for small answer values the tiny fraction should be calcualted as a fraction of the number and not an absolute value
      actually ("1.0e-".ini_get('precision')); can gives something like 1e-13 for a precision of 8 .
      After completing tests, a working solution will be proposed soon

      Attachments

        Issue Links

          Activity

            People

              timhunt Tim Hunt
              ppichet Pierre Pichet
              Nobody Nobody
              Safat Shahin, Tim Hunt, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: