From e1e589e7293a439ccc85246e5c90c132069033ee Mon Sep 17 00:00:00 2001 From: Blub Date: Fri, 4 Sep 2009 10:35:41 +0000 Subject: [PATCH] keep using num*sign when the token has no . in it, since in such cases it shouldn't become NaN, and we cannot use atof on tokens like 0xABC which end up, too git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3369 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/qclib/qcc_pr_lex.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engine/qclib/qcc_pr_lex.c b/engine/qclib/qcc_pr_lex.c index 4a0dd3b29..6b442bca8 100644 --- a/engine/qclib/qcc_pr_lex.c +++ b/engine/qclib/qcc_pr_lex.c @@ -1435,8 +1435,10 @@ void QCC_PR_LexNumber (void) else { pr_immediate_type = type_float; - pr_immediate._float = atof(pr_token); - //pr_immediate._float = (float)(num*sign); + // at this point, we know there's no . in it, so the NaN bug shouldn't happen + // and we cannot use atof on tokens like 0xabc, so use num*sign, it SHOULD be safe + //pr_immediate._float = atof(pr_token); + pr_immediate._float = (float)(num*sign); } }