Help:Type Number 1.0 - 1.5.6

From semantic-mediawiki.org
Jump to: navigation, search

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.



This documentation page applies to all SMW versions from 1.0 to 1.5.6.
Other versions: ≥ 1.6.0      

Help:Type Number en 1.0 1.5.6