SWI-Prolog -- Using digit groups in large integers

Did you know ... Search Documentation:
SWI-Prolog owl logo Using digit groups in large integers

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.

Tags are associated to your profile if you are logged in
Tags:
login to add a new annotation post.

AltStyle によって変換されたページ (->オリジナル) /