From 4b88bb729333c656f4a3b5ea783a171d4493346b Mon Sep 17 00:00:00 2001 From: TimeServ Date: Fri, 19 May 2006 04:22:12 +0000 Subject: [PATCH] adjust ftoa function a bit more git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2289 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/common/common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engine/common/common.c b/engine/common/common.c index bfb0e93de..973811f98 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -331,7 +331,7 @@ int Q_strcasecmp (char *s1, char *s2) // Q_ftoa: convert IEEE 754 float to a base-10 string with "infinite" decimal places void Q_ftoa(char *str, float in) { - unsigned int i = *((float *)&in); + unsigned int i = *((int *)&in); int signbit = (i & 0x80000000) >> 31; int exp = (signed int)((i & 0x7F800000) >> 23) - 127; @@ -353,14 +353,14 @@ void Q_ftoa(char *str, float in) exp = -exp; exp = (int)(exp * 0.30102999957f); // convert base 2 to base 10 - exp += 11; // + exp += 8; if (exp <= 0) sprintf(str, "%f", in); else { char tstr[8]; - char *lsig = str - 1; // last significant character + char *lsig = str - 1; sprintf(tstr, "%%.%if", exp); sprintf(str, tstr, in); // find last significant digit and trim