Definition

According with the Fōrmulæ Arithmetic canon, number expressions must have the following properties:

They represent only either positive real numbers or zero. A negative number should be represented by a Math.Arithmetic.Negative expression containing a Math.Number expression as its only child.

There are two types: Integer and decimal numbers. Integer numbers can represent only integer values, while decimal numbers can represent both integer and fractional values.

This expression must have no children.

This expression has internal state, which is an internal value of the number it contains. The format of this number —floating point, arbitrary precision, etc.— depends of the particular implementation.

Visualization

There could be different visualizations, according with specific features, such like showing big numbers in scientific notation, showing numbers in different numeral systems, or for localization purposes.

Independently of the visualization method, there should be a way to differentiate the visualization of an integer number from a decimal number with no fractional part.

Edition

When editing the number to be created or modified, there should be a way to differentiate when introducing an integer number from a decimal number with no fractional part.

Reduction

Since this expression is not expected to be reduced to a different one, no reducers are currently known.

Known implementations

This package provides an implementation of the Math.Number expression, which supports the following features:

Arbitrary precision, this is, it can hold integer numbers with any number of digits, and decimal numbers with any number of digits on its integer and decimal part. There is a limit, but it is imposed by memory availability, not by design.

Localization. Numbers are introduced and shown accordingly to the user locale.

Visualization

There is one visualization on this package, which shows numbers accordingly to the following:

Numbers are always shown in base 10.

Numbers are always shown using Hindu-Arabic numerals, This is, the symbols 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9 from the Latin alphabet. The symbol used as a decimal separator is locale dependent. This usage is increasing —to represent numbers— even in languages that traditionally use other alphabets, such as Kanji, Greek, Hebrew or Cyrillic.

Numbers are always shown left to right. It is a common practice even in right-to-left written languages, such as Arabic or Hebrew, when using Hindu-Arabic numerals to represent numbers.

Numbers are shown with no leading zeroes before the integer part, unless its integer part is zero.

Numbers are shown with no trailing zeroes after the fractional part (if any).

Number are not shorten in any way —i.e. scientific notation—, so be careful because either big numbers or numbers with many decimal places will could produce visually very wide results.

In order to differentiate integer numbers from decimal numbers with no fractional part, the latter is always shown with a trailing decimal separator.

The integer part of the number (if any) is shown separated by a group separator, usually every three places. This symbol is locale dependent.

The following shows examples of this visualization on different numbers, in several locales:

Number type

Example in United States

Example in France

Example in Italy

Integer number

1,234

1 234

1.234

Decimal number with fractional part

1,234.567

1 234,567

1.234,567

Decimal number with no fractional part

1,234.

1 234,

1.234,

Decimal number with no integer part

0.567

0,567

0,567

Integer zero

0

0

0

Decimal zero

0.

0,

0,

Edition

when a number is created or modified the user should write the number with a trailing decimal point when introducing a decimal number with no fractional part, in order to differentiate it from an integer.

When a number expression is created, it substitutes the previous selected expression. After the creation, the number expression becames the selected expression.

Edition "Creation of a number"

Since this expression has internal state, it opens a dialog box in order that the user can write the number. The new Math.Number expression substitutes the current selected expression and becames the new selected expression.

Action "Edition of a number"

Since this expression has internal state, it opens a dialog box in order that the user can write the new number. The internal number of the Math.Number currently selected is changed to the new value.