• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

2.15.1 ISO Syntax Support
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • Overview
        • The SWI-Prolog syntax
          • ISO Syntax Support
            • Processor Character Set
            • Nested comments
            • Character Escape Syntax
            • Syntax for non-decimal numbers
            • Using digit groups in large integers
            • Rational number syntax
            • NaN and Infinity floats and their syntax
            • Force only underscore to introduce a variable
            • Unicode Prolog source
            • Singleton variable checking
    • Packages

2.15.1.5 Using digit groups in large integers

SWI-Prolog supports splitting long integers into digit groups. Digit groups can be separated with the sequence <underscore>, <optional white space>. If the <radix> is 10 or lower, they may also be separated with exactly one space. The following all express the integer 1 million:

1_000_000
1 000 000
1_000_/*more*/000

Integers can be printed using this notation with format/2, using the ~I format specifier. For example:

?- format('~I', [1000000]).
1_000_000

The current syntax has been proposed by Ulrich Neumerkel on the SWI-Prolog mailinglist.

ClioPatria (version V3.1.1-51-ga0b30a5)