using atof() for floats in QCC_PR_LexNumber() so huge numbers don't create NaNs

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3363 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Blub 2009-09-01 22:23:47 +00:00
parent 59d474b547
commit e0f2bb3a50

View file

@ -1382,16 +1382,12 @@ void QCC_PR_LexNumber (void)
pr_token[tokenlen++] = c; pr_token[tokenlen++] = c;
pr_file_p++; pr_file_p++;
pr_immediate_type = type_float; pr_immediate_type = type_float;
pr_immediate._float = (float)num;
num = 1;
while(1) while(1)
{ {
c = *pr_file_p; c = *pr_file_p;
if (c >= '0' && c <= '9') if (c >= '0' && c <= '9')
{ {
pr_token[tokenlen++] = c; pr_token[tokenlen++] = c;
num*=10;
pr_immediate._float += (c-'0')/(float)(num);
} }
else if (c == 'f') else if (c == 'f')
{ {
@ -1404,7 +1400,7 @@ void QCC_PR_LexNumber (void)
} }
pr_file_p++; pr_file_p++;
} }
pr_immediate._float *= sign; pr_immediate._float = atof(pr_token);
pr_token[tokenlen++] = 0; pr_token[tokenlen++] = 0;
return; return;
} }
@ -1439,7 +1435,8 @@ void QCC_PR_LexNumber (void)
else else
{ {
pr_immediate_type = type_float; pr_immediate_type = type_float;
pr_immediate._float = (float)(num*sign); pr_immediate._float = atof(pr_token);
//pr_immediate._float = (float)(num*sign);
} }
} }