mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-31 05:30:48 +00:00
Merge remote-tracking branch 'origin/master' into rscache
This commit is contained in:
commit
1dc080e8cd
1 changed files with 7 additions and 6 deletions
13
src/m_misc.c
13
src/m_misc.c
|
@ -2618,14 +2618,15 @@ const char * M_Ftrim (double f)
|
||||||
static char dig[9];/* "0." + 6 digits (6 is printf's default) */
|
static char dig[9];/* "0." + 6 digits (6 is printf's default) */
|
||||||
int i;
|
int i;
|
||||||
/* I know I said it's the default, but just in case... */
|
/* I know I said it's the default, but just in case... */
|
||||||
sprintf(dig, "%.6g", modf(f, &f));
|
sprintf(dig, "%.6f", fabs(modf(f, &f)));
|
||||||
if (dig[0])
|
/* trim trailing zeroes */
|
||||||
{
|
for (i = strlen(dig)-1; dig[i] == '0'; --i)
|
||||||
for (i = strlen(dig); dig[i] == '0'; --i)
|
|
||||||
;
|
;
|
||||||
|
if (dig[i] == '.')/* :NOTHING: */
|
||||||
|
return "";
|
||||||
|
else
|
||||||
|
{
|
||||||
dig[i + 1] = '\0';
|
dig[i + 1] = '\0';
|
||||||
return &dig[1];/* skip the 0 */
|
return &dig[1];/* skip the 0 */
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue