Development:Question Engine 2:Numerical formats: Difference between revisions

From MoodleDocs
(Created page with "The Question Engine 2 structure allows implementation of new features for numerical question types ( numerical and calculated). This page describes a possible implementation and ...")
 
Line 24: Line 24:
, is also used to separate variables so PHP use a simpler syntax 123456.78.
, is also used to separate variables so PHP use a simpler syntax 123456.78.


As this is stored in the computer as 2 parts 1.2345678+E05 will be a structure that is well recognized by computer language as PHP.
As this is stored in the computer as 2 parts (number and exponent).
1.2345678+E05 will be a structure that is well recognized by a computer language as PHP.
 
==Setting the answer when creating the question==
 
==Retrieving the numerical value from the student response==
 
==Grading the numerical format used by the student to express the numerical value ==


[[User:Pierre Pichet|Pierre Pichet]] 07:39, 1 May 2011 (WST)
[[User:Pierre Pichet|Pierre Pichet]] 07:39, 1 May 2011 (WST)

Revision as of 23:48, 30 April 2011

The Question Engine 2 structure allows implementation of new features for numerical question types ( numerical and calculated). This page describes a possible implementation and its rationale.

The text should be readed as a personal summary of the work in progress and not as a textbook on computer language and real numbers representation.

It is related to the forum discussion


Numbers as written by human and readed by computer language

The main feature of numerical question type is to ask the student to give a numerical answer i.e. a number. Most often this means a numerical value that is not an integer ( dates are a current example of integer value response) but a real number which value is expressed most often as a decimal number i.e 1.234 .

Computer languages ( i.e PHP used in Moodle) store real numbers in a different way than human do (decimal part and exponent similar to 1.234 E00) and humans do not expressed real nmumbers in an universal format.

The separator between the unit and the decimal fraction is often either a . or a ,  
1.234   1,234

Furthermore to help reading large numbers, most language add another separator for thousands often space or , if it is not used already as unit separator.

123 456.78     123,456.78   123 456,78 

PHP as a computer language use space to separate the language components so cannot use space as a thousand separator.

, is also used to separate variables so PHP use a simpler syntax 123456.78.

As this is stored in the computer as 2 parts (number and exponent).

1.2345678+E05 will be a structure that is well recognized by a computer language as PHP.

Setting the answer when creating the question

Retrieving the numerical value from the student response

Grading the numerical format used by the student to express the numerical value

Pierre Pichet 07:39, 1 May 2011 (WST)