4.22 Analysing and Constructing Atoms
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Built-in Predicates
        • Analysing and Constructing Atoms
          • atom_codes/2
          • atom_chars/2
          • char_code/2
          • number_chars/2
          • number_codes/2
          • atom_number/2
          • name/2
          • term_to_atom/2
          • atom_to_term/3
          • atom_concat/3
          • atomic_concat/3
          • atomic_list_concat/2
          • atomic_list_concat/3
          • atom_length/2
          • atom_prefix/2
          • sub_atom/5
          • sub_atom_icasechk/3
    • Packages
Availability:built-in
[ISO]number_chars(?Number, ?CharList)
Similar to atom_chars/2, but converts between a number and its representation as a list of one-character atoms. If CharList is a proper list, i.e., not unbound or a partial list, CharList is parsed according to the Prolog syntax for numbers and the resulting number is unified with Number. Otherwise, if Number is a number, Number is serialized and the result is unified with CharList.

If CharList is parsed, it is parsed using the Prolog syntax for numbers. Following the ISO standard, it allows for leading white space (including newlines) and does not allow for trailing white space.105ISO also allows for Prolog comments in leading white space. We--and most other implementations--believe this is incorrect. We also beleive it would have been better not to allow for white space, or to allow for both leading and trailing white space. Prolog syntax-based conversion can also be achieved using format/3 and read_from_chars/2. A syntax_error exception is raised if CharList does not represent a valid Prolog number.