Atom_number bug

I’m using: SWI-Prolog version 2.1.22

atom_number('1_2", X).

yields 12.

That is not a bug, it is a feature of integers. To make it easier to read long integer, e.g.

12340963244306346231781234

_ can be inserted instead of ‘,’ or ‘.’ depending upon how you are use to formatting integers, e.g.

12_340_963_244_306_346_231_781_234

As another example that might seem odd but is correct.

?- X = 1_234.
X = 1234.

See: Using digit groups in large integers

but the right part should be 3 integers…

Pushed a fix.

1 Like