Next: , Up: The setFormat Element   [Contents]


2.4.10.1 The numberFormat Element

numberFormat
   :minimumIntegerDigits=int?
   :maximumFractionDigits=int?
   :minimumFractionDigits=int?
   :useGrouping=bool?
   :scientific=(onlyForSmall | whenNeeded | true | false)?
   :small=real?
   :prefix?
   :suffix?
=> affix*

Specifies a format for displaying a number. The available options are a superset of those available from PSPP print formats. PSPP chooses a print format type for a numberFormat as follows:

  1. If scientific is true, uses E format.
  2. If prefix is $, uses DOLLAR format.
  3. If suffix is %, uses PCT format.
  4. If useGrouping is true, uses COMMA format.
  5. Otherwise, uses F format.

For translating to a print format, PSPP uses maximumFractionDigits as the number of decimals, unless that attribute is missing or out of the range [0,15], in which case it uses 2 decimals.

Attribute: minimumIntegerDigits

Minimum number of digits to display before the decimal point. Always observed as 0.

Attribute: maximumFractionDigits
Attribute: minimumFractionDigits

Maximum or minimum, respectively, number of digits to display after the decimal point. The observed values of each attribute range from 0 to 9.

Attribute: useGrouping

Whether to use the grouping character to group digits in large numbers.

Attribute: scientific

This attribute controls when and whether the number is formatted in scientific notation. It takes the following values:

onlyForSmall

Use scientific notation only when the number’s magnitude is smaller than the value of the small attribute.

whenNeeded

Use scientific notation when the number will not otherwise fit in the available space.

true

Always use scientific notation. Not observed in the corpus.

false

Never use scientific notation. A number that won’t otherwise fit will be replaced by an error indication (see the errorCharacter attribute). Not observed in the corpus.

Attribute: small

Only present when the scientific attribute is onlyForSmall, this is a numeric magnitude below which the number will be formatted in scientific notation. The values 0 and 0.0001 have been observed. The value 0 seems like a pathological choice, since no real number has a magnitude less than 0; perhaps in practice such a choice is equivalent to setting scientific to false.

Attribute: prefix
Attribute: suffix

Specifies a prefix or a suffix to apply to the formatted number. Only suffix has been observed, with value ‘%’.


Next: The stringFormat Element, Up: The setFormat Element   [Contents]