scan numbers

This commit is contained in:
Vítor Santos Costa
2015-10-18 11:48:51 +01:00
parent 684e733c8b
commit 1c727bbe45
2 changed files with 10 additions and 30 deletions

View File

@@ -68,31 +68,6 @@ Term Yap_StringToNumberTerm(char *s, encoding_t *encp) {
while (*s && isblank(*s++))
;
t = Yap_scan_num(GLOBAL_Stream + sno);
if (t == TermNil) {
CACHE_REGS
int sign = 1;
if (s[0] == '+') {
s++;
}
if (s[0] == '-') {
s++;
sign = -1;
}
if (strcmp(s, "inf") == 0) {
if (sign > 0) {
return MkFloatTerm(INFINITY);
} else {
return MkFloatTerm(-INFINITY);
}
}
if (strcmp(s, "nan") == 0) {
if (sign > 0) {
return MkFloatTerm(NAN);
} else {
return MkFloatTerm(-NAN);
}
}
}
Yap_CloseStream(sno);
UNLOCK(GLOBAL_Stream[sno].streamlock);
return t;