I’m using: SWI-Prolog version 2.1.22
atom_number('1_2", X).
yields 12.
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.
I got this error. The second query result is wrong:
SWI-Prolog (threaded, 64 bits, version 8.1.22)
?- atom_number('1r2', X).
X = 1r2.
?- atom_number(X, 1r2).
X = '12'.
but the right part should be 3 integers…
Pushed a fix.