avoid strict float checking when building arrays.w

This commit is contained in:
Vítor Santos Costa 2012-03-22 21:38:22 +00:00
parent 8c6b68278c
commit 7b78832aa7
1 changed files with 14 additions and 3 deletions

View File

@ -3612,9 +3612,20 @@ YAP_ListToFloats(Term t, double *dblp, size_t sz)
if (!IsPairTerm(t))
return -1;
hd = HeadOfTerm(t);
if (!IsFloatTerm(hd))
return -1;
dblp[i++] = FloatOfTerm(hd);
if (IsFloatTerm(hd)) {
dblp[i++] = FloatOfTerm(hd);
} else {
extern double Yap_gmp_to_float(Term hd);
if (IsIntTerm(hd))
dblp[i++] = IntOfTerm(hd);
else if (IsLongIntTerm(hd))
dblp[i++] = LongIntOfTerm(hd);
else if (IsBigIntTerm(hd))
dblp[i++] = Yap_gmp_to_float(hd);
else
return -1;
}
if (i == sz)
return sz;
t = TailOfTerm(t);