Difference between revisions of "Type:Number"
Warning: Parameter 1 to MapsHooks::onParserClearState() expected to be a reference, value given in /var/www/vhosts/shdenham.co.uk/httpdocs/mw/includes/Hooks.php on line 201
Warning: Parameter 1 to ExtArrays::onParserClearState() expected to be a reference, value given in /var/www/vhosts/shdenham.co.uk/httpdocs/mw/includes/Hooks.php on line 201
Warning: Parameter 1 to Cite::clearState() expected to be a reference, value given in /var/www/vhosts/shdenham.co.uk/httpdocs/mw/includes/Hooks.php on line 201
From Aktanak
(Created page with 'The datatype '''number''' is used for properties that contain any kind of number, integer, decimal, and floating point numbers. It can be positive o…') |
(No difference)
|
Revision as of 17:58, 27 May 2010
The datatype number is used for properties that contain any kind of number, integer, decimal, and floating point numbers. It can be positive or negative, with thousand separators, and it can have an optional exponent. For example, 42, -273.15, and 4,297.31 e7 are valid numbers.
It is possible to use units of measurement with number values. They can be specified as arbitrary non-numerical strings after the number. Though Type:Number does not understand units (i.e. it performs no automatic conversion), a unit can be used to distinguish property values with different units to avoid accidental comparison of quantities that have been given in different units. It is also possible to create a datatype that is aware of units; see Custom units.
Numbers in other languages
Numbers are written differently in different languages, and some of these differences are taken into account by SMW. In particular, there is no global consensus on how to write the decimal separator ("." in English) and the thousands separators ("," in English). When using SMW in a wiki that does not use English as a content language, the format for numbers might change according to the local customs. For example, German numbers use "," as a decimal separator and "." as a thousands separator, so German "1,234" is the same as English "1.234" not "1234".
To find out about (and possibly change) the separators used in your language, see the messages MediaWiki:smw_decseparator and MediaWiki:smw_kiloseparator. Note that the thousands (kilo) separator is optional, and is used only for formatting in some languages where it is not needed for the input. For example, French numbers group thousands with spaces, which is allowed anyway, and thus their thousands separator is a non-breakable space even though this will rarely be typed by users when writing numbers.
Types Float and Integer
Type:Number is a universal replacement for the separate datatypes and Float and Integer used in early versions of Semantic MediaWiki. Integer and Float are aliases for Type:Number since SMW 1.0.