ISO/IEC JTC1 SC22 WG17
A comparison of contemporary implementations of number_chars/2

This comparison includes contemporary systems with the directive set_prolog_flag(double_quotes,chars). It includes all cases 1..53 from the original comparison which was used in preparation of Cor.2:2012.

ISO Prolog works, comparison of syntax

#Queryanswer description 8.16.7 (quad) SICStus 4.9.0 Scryer 0.10.0 Trealla 3.9.32 Ichiban 1.2.0 GNU 1.6.0 Flowlog 4.10.1 Eye 1.3.33 Shumway 0.9.2 X 1.0.63 Tau 0.3.4 ECLiPSe 7.0#42 -L iso IV 1.4.2 SWI 9.3.17 YAP 7.4.0 B 7.8b7 IF V5.1B Minerva 2.4 Cx 0.98.3 pre Cor.2
#Queryanswer description SI Sc Tr 1b GN Fl Ey Sh X Τ EC IV SW YA B IF Mi Cx -2
1?- number_chars(1.2,"1.2"). true. OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK
55?- number_chars(1.2,"1.20"). true. OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK false false OK
2?- number_chars(1.0e9,"1.0E9"). true. OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK false OK
56?- number_chars(1.0e9,"1.0e9"). true. OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK false false OK
64?- number_chars(0.0,"-0.0"). true. OK OK OK OK OK OK OK OK OK OK false OK false OK false OK false false OK
3?- number_chars(1,"01"). true. OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK false false OK
65?- number_chars(10,"010"). true. OK OK OK OK OK ON OK OK OK OK OK OK OK OK OK OK false false OK
66?- number_chars(N,"010"). N=10. OK OK OK OK OK ON OK OK OK OK OK OK OK OK OK OK OK OK OK
67?- number_chars(N,"08"). N=8. OK OK OK OK OK ON OK OK OK OK OK OK OK OK OK OK OK OK OK
68?- number_chars(N,"0b11"). N=3. OK OK OK OK OK ON OK OK OK OK OK OK OK OK OK OK OK false OK
69?- number_chars(N,"0o11"). N=9. OK OK OK OK OK ON OK OK OK OK OK OK OK OK OK OK OK false OK
70?- number_chars(N,"0x11"). N=17. OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK N=17.0 OK
4?- number_chars(1,"a"). syntax_error(...). OK OK OK OK OK OK OK OK OK OK OK OK OK aborts OK OK false false OK
5?- number_chars(1,[]). syntax_error(...). OK OK OK OK OK OK OK OK OK OK OK OK OK aborts OK OK false false OK
6?- number_chars(1,[[]]). type_error(character,[]). OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK false false OK
7?- number_chars(1,[' ',[]]). type_error(character,[]). OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK false false OK
8?- number_chars(1,[0]). type_error(character,0). OK OK OK OK OK OK OK OK OK OK OK OK s._e.(..) aborts OK OK false false OK
9?- number_chars(1,[_,[]]). type_error(character,[]). OK OK OK OK OK OK OK OK OK OK OK OK false false false OK false false OK
10?- number_chars(N,[X]). instantiation_error. OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK
11?- number_chars(N,['0'|_]). instantiation_error. OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK
12?- number_chars(N,'1'). type_error(list,'1'). OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK
13?- number_chars(N,[a|a]). type_error(list,[a|a]). OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK ..(..,a) i._e. OK
14?- number_chars(N,[49]). type_error(character,49). OK OK OK OK OK OK OK OK OK OK OK OK N=1 N=1 OK OK OK OK OK
15?- number_chars(N,[]). syntax_error(...). OK OK OK OK OK OK OK OK OK OK OK OK OK aborts OK OK OK false OK
16?- number_chars(N,"3 "). syntax_error(...). OK OK OK OK OK OK OK OK OK OK OK OK OK aborts OK N=3 OK false OK
17?- number_chars(N,"3."). syntax_error(...). OK OK OK OK OK ON OK OK OK OK OK OK OK N=3 OK OK N=3.0 false OK
18?- number_chars(N," 1"). N = 1. OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK false OK
19?- number_chars(N,"\n1"). N = 1. OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK s._e.(..) OK false OK
20?- number_chars(N," 0'a"). N = 0'a. N = 97. OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK false OK
58?- number_chars(N,"0'"). syntax_error(...). OK ON ON OK OK OK OK OK OK OK N=0 OK OK N= -1 OK OK OK false OK
59?- number_chars(N,"0'\n"). syntax_error(...). OK OK ON OK OK ON OK OK OK j.err OK OK N=10 N=10 N=10 N=10 N=10 false OK
60?- number_chars(N,"0'\\n"). N=0'\n. N=10. OK OK OK OK OK OK OK OK OK OK OK OK s._e.(..) OK OK OK OK false OK
61?- number_chars(N,"0'\\7\\"). N=7. OK OK OK OK OK OK OK OK OK OK OK OK s._e.(..) OK OK s._e.(..) s._e.(..) false OK
71?- number_chars(N,"0'\\7"). syntax_error(...). OK OK OK OK OK ON OK OK OK OK OK OK OK N=0 OK OK N=7 false OK
62?- number_chars(N,"0'."). N=0'. . N = 46. OK ON OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK false OK
21?- number_chars(N,"- 1"). N = -1. OK OK OK OK OK ON OK OK OK s._e.(..) OK s._e.(..) s._e.(..) aborts OK OK s._e.(..) false OK
54?- number_chars(N,"'-'1"). N = -1. OK OK OK OK ON ON OK OK OK OK OK s._e.(..) s._e.(..) aborts s._e.(..) s._e.(..) s._e.(..) false OK
22?- number_chars(N,"/**/1"). N = 1. OK OK OK OK ON ON OK OK OK OK OK OK s._e.(..) aborts OK s._e.(..) s._e.(..) false OK
23?- number_chars(N,"%\n1"). N = 1. OK OK OK OK ON ON OK OK s._e.(..) OK OK OK s._e.(..) aborts OK s._e.(..) s._e.(..) false OK
74?- number_chars(N,"-%\n0"). N = 0. OK OK OK OK OK OK ON OK s._e.(..) s._e.(..) OK s._e.(..) s._e.(..) aborts OK s._e.(..) s._e.(..) false OK
88?- number_chars(N,"0''"). syntax_error(...). OK OK OK OK OK OK OK OK OK N=39 OK OK N=39 OK@ N= -1 OK N=39 false OK
75?- number_chars(N,"0'''"). N = 39. OK OK OK OK OK OK ON OK OK OK OK OK OK aborts OK OK s._e.(..) false OK
76?- number_chars(N,"0'\\'"). N = 39. OK OK OK OK OK OK ON OK OK OK OK OK s._e.(..) OK OK OK OK false OK
77?- number_chars(N,"0' "). N = 32. OK OK OK OK OK OK ON OK OK OK OK OK OK OK OK OK OK false OK
57?- number_chars(N,"- /**/1"). N = -1. OK OK OK OK ON ON OK OK OK s._e.(..) OK s._e.(..) s._e.(..) aborts OK s._e.(..) s._e.(..) false OK
24?- number_chars(N,"-/**/1"). syntax_error(...). OK OK OK OK OK OK OK OK OK OK OK OK OK aborts N= -1 OK OK false OK
63?- number_chars(N,"'\\\n-' 3"). N= -3. OK OK ON OK ON ON OK OK OK s._e.(..) OK s._e.(..) s._e.(..) aborts s._e.(..) s._e.(..) s._e.(..) false OK
25?- number_chars(N,"1e1"). syntax_error(...). OK OK OK OK OK ON OK OK OK OK OK OK N=10.0 N=10.0 OK OK N=10.0 N=10.0 OK
26?- number_chars(N,"1.0e"). syntax_error(...). OK OK OK OK OK OK OK OK OK OK OK OK OK N=1 OK OK OK false OK
27?- number_chars(N,"1.0ee"). syntax_error(...). OK OK OK OK OK OK OK OK OK OK OK OK OK aborts OK OK OK false OK
28?- number_chars(N,"0x1"). N = 1. OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK N=1.0 OK
29?- number_chars(N,"0X1"). syntax_error(...). OK OK OK OK OK ON OK OK OK OK OK OK OK aborts OK OK OK N=1.0 OK
30?- number_chars(N,"1E1"). syntax_error(...). OK OK OK OK OK ON OK OK OK OK OK OK N=10.0 N=10.0 OK N=10.0 N=10.0 N=10.0 OK
73?- number_chars(N,"(0)"). syntax_error(...). OK OK OK OK OK OK ON OK OK N=0 OK OK OK aborts OK OK OK false OK
84?- number_chars(N,"0%0'"). syntax_error(...). OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK false OK
78?- number_chars(N,"1.0e-8"),
number_chars(N,L),
number_chars(N,L).
N= ...,L= ... . OK OK OK OK OK OK ON OK OK OK s._e.(..) OK OK OK OK OK OK "1e-08" OK
47?- number_chars(1,['.'|_]). false. OK OK OK OK OK OK OK OK OK OK OK OK OK OK i._e. i._e. OK false OK
48?- number_chars(N,"+1"). syntax_error(...). OK OK OK OK OK ON OK OK OK OK OK OK N=1 N=1 OK N=1 N=1 false OK
49?- number_chars(N,"+ 1"). syntax_error(...). OK OK OK OK OK OK OK OK OK OK OK OK OK aborts OK N=1 OK false OK
50?- number_chars(N,"'+'1"). syntax_error(...). OK OK OK OK OK OK OK OK OK OK OK OK OK aborts OK OK OK false OK
51?- number_chars(N,['11']). type_error(character,'11'). OK OK OK OK OK OK OK OK OK OK OK OK ..(c._c.,..) OK OK OK OK OK OK
52?- number_chars(N,['1.1']). type_error(character,'1.1'). OK OK OK OK OK OK OK OK OK OK OK OK ..(c._c.,..) OK OK OK OK OK OK
53?- number_chars(1+1,"2"). type_error(number,1+1). OK OK OK OK OK OK OK OK OK OK false OK OK false OK true ..(d.,..) ..(a.,..) OK
31?- number_chars(1,[C]). C = '1'. OK OK OK OK OK OK OK OK OK OK OK t._e.(c.,_) OK OK OK OK OK OK t._e.(c.,_)
32?- number_chars(1,[C,D]). false. OK OK OK OK OK OK OK OK OK OK OK t._e.(c.,_) OK OK OK i._e. OK OK t._e.(c.,_)
33?- number_chars(1,[C,C]). false. OK OK OK OK OK OK OK OK OK OK OK t._e.(c.,_) OK OK OK i._e. OK OK t._e.(c.,_)
34?- number_chars(0,[C,C]). false. OK OK OK OK OK OK OK OK OK OK OK t._e.(c.,_) OK OK OK i._e. OK OK t._e.(c.,_)
35?- number_chars(10,[C,D]). C = '1', D = '0'. OK OK OK OK OK OK OK OK OK OK OK t._e.(c.,_) OK OK OK OK OK OK t._e.(c.,_)
36?- number_chars(100,[C,D]). false. OK OK OK OK OK OK OK OK OK OK OK t._e.(c.,_) OK OK OK i._e. OK OK t._e.(c.,_)
37?- number_chars(N,[X|2]). type_error(list,[_|2])
| instantiation_error.
t
i
t
i

i
t t t
i
t t
i

i

i

i

i

i

i
t
38?- number_chars(N,[1|_]). instantiation_error
| type_error(character,1).

t
i
t

t

t
i
t
i
t

t

t
i i i
t

t

t

t
i
39?- number_chars(V,[1|2]). type_error(list,[1|2])
| type_error(character,1).
l l l
c

c
l l
c

c

c

c

c
l l
c

c

c

c
l
40?- number_chars([],1). type_error(number,[])
| type_error(list,1).
n n n
l
n n n n n n
l
n n ..(t.,1) n n ..(d.,[]) ..(a.,[]) n
41?- number_chars(1,1). type_error(list,1). OK OK OK OK OK OK OK OK OK OK OK OK OK ..(t.,1) OK OK OK false false
42?- number_chars(1,[a|2]). type_error(list,[a|2]). OK OK OK OK OK OK OK OK OK OK OK false OK ..(..,2) OK OK false false false
43?- number_chars(1,[_|2]). type_error(list,[_|2]). OK OK OK OK OK OK OK OK OK OK OK ..(c.,_) false false OK OK false false false
44?- number_chars(1,[[]|_]). type_error(character,[]). OK OK OK OK OK OK OK OK OK OK OK OK ..(c._c.,[]) false i._e. OK false false false
45?- number_chars(1,[[]|2]). type_error(character,[])
| type_error(list,[[]|2]).

l

l

l
c c c
l
c c c c c ..(c._c.,[]) c
l
c false false false
72?- number_chars(V,[1,[],X|2]). type_error(list,[1,[],_A|2])
| type_error(character,1)
| type_error(character,[])
| instantiation_error.
l


i
l
1

1
l l
1

1

1

1



i


[]



i

1

1

1

1
l
83?- number_chars(N,[1,2,3]). type_error(character,1)
| type_error(character,2)
| type_error(character,3).
1 1 1 1 1 1 1 1 1 1 1 1 s._e.(..) aborts 1 1 1 1 1
| 2
| 3
79?- N is 0.1*10** -999. N = 0.0
| evaluation_error(underflow).
0 0 0
e
0 0 0 0 0 s._e.(..)/0 0
e
0 0 0 0 0 0 0
| e
80?- number_chars(N,"0.1e-999"). N = 0.0
| representation_error(number).
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
r
0 0 0
81?- N is 9.9*10**999. evaluation_error(float_overflow). f f f f f e._e.(un.) f f f f 1.0Inf e._e.(ov.) f +inf inf f Infinity.0 +inf f
82?- number_chars(N,"9.9e999"). representation_error(max_float)
| representation_error(float)
| representation_error(number).
syntax_error(...), unexpected.



s



s
m +Inf.0 inf


s
m m


s
Infinity.0 1.0Inf loops


s
+inf inf

n
Infinity.0 +inf undef.
85?- char_code(N,0),
char_code(N,Null),Null==0.
representation_error(character_code)
| N = ..., Null=0. % '\0\'

0

0

0

0
r
0

0

0
r
0

0

0

0
..(in_..) r r
0

0
r
|0
86?- number_chars(N,"0'\\0\\"). representation_error(character_code)
| N = 0.

0

0

0

0
s._e.(..) s._e.(..)
0

0
s._e.(..)
0

0

0
s._e.(..)
0

0
loops s._e.(..) false
87?- number_chars(1,[C|C]). false. OK OK OK OK OK OK OK OK OK OK OK t._e(c.,..) OK OK i._e. i._e. OK OK OK
46?- L=['1'|L], number_chars(N,L).
% * is default
sto, ... ; ... .
sto, false % occurs-check
| sto, representation_error(term)
| sto, loops % rational trees
| sto, type_error(list,['1'|...])
| sto, resource_error(...)
| sto, instantiation_error. % literal substitutions




t*

f
|r

t*

f
|r

t*




t*



l*

f

l*

f*
|r

f
|r

t*




t*

f




|i*



l*



l*

f
|o.(_,..)

t*




t*



l*



l*



l*



l*
sto
classmeaning
regregular use
goodconforming
corpcorrect but problematic
badxextension
badcerror's culprit wrong
badterror's type wrong
badeerror class wrong
badrrejection unexpected
badmmisinterpretation
badvvulnerability

TODO

89 number_chars(N,"0'\\0").

Systems not considered

See original comparison for their conformity.

XSB 5.0.0:

| ?- set_prolog_flag(double_quotes,chars).
++Error[XSB/Runtime/P]: [Domain (chars not in domain flag_value)] unexpected.

Ciao 1.24.0:

?-  set_prolog_flag(double_quotes,chars).

yes
?- writeq("abc").
[97,98,99] unexpected.
yes

JI 3.1.0-2

JIP:-set_prolog_flag(double_quotes,chars).
- Warning, the predicate set_prolog_flag/2 is undefined.
No

JIP:-writeq("abc").
[97, 98, 99] unexpected
Yes

Version Control, Validated HTML