mirror of https://github.com/mgba-emu/mgba.git
Util: Fix formatting of floats
This commit is contained in:
parent
0eb76806be
commit
e528f673b8
1
CHANGES
1
CHANGES
|
@ -72,6 +72,7 @@ Bugfixes:
|
||||||
- Qt: Fix crashes on Windows by using using QMetaObject to do cross-thread calls
|
- Qt: Fix crashes on Windows by using using QMetaObject to do cross-thread calls
|
||||||
- GBA Video: Fix timing on first scanline
|
- GBA Video: Fix timing on first scanline
|
||||||
- GBA: Ensure cycles never go negative
|
- GBA: Ensure cycles never go negative
|
||||||
|
- Util: Fix formatting of floats
|
||||||
Misc:
|
Misc:
|
||||||
- Qt: Handle saving input settings better
|
- Qt: Handle saving input settings better
|
||||||
- Debugger: Free watchpoints in addition to breakpoints
|
- Debugger: Free watchpoints in addition to breakpoints
|
||||||
|
|
|
@ -9,20 +9,20 @@
|
||||||
|
|
||||||
int ftostr_l(char* restrict str, size_t size, float f, locale_t locale) {
|
int ftostr_l(char* restrict str, size_t size, float f, locale_t locale) {
|
||||||
#ifdef HAVE_SNPRINTF_L
|
#ifdef HAVE_SNPRINTF_L
|
||||||
return snprintf_l(str, size, locale, "%*.g", FLT_DIG, f);
|
return snprintf_l(str, size, locale, "%.*g", FLT_DIG, f);
|
||||||
#elif defined(HAVE_LOCALE)
|
#elif defined(HAVE_LOCALE)
|
||||||
locale_t old = uselocale(locale);
|
locale_t old = uselocale(locale);
|
||||||
int res = snprintf(str, size, "%*.g", FLT_DIG, f);
|
int res = snprintf(str, size, "%.*g", FLT_DIG, f);
|
||||||
uselocale(old);
|
uselocale(old);
|
||||||
return res;
|
return res;
|
||||||
#elif defined(HAVE_SETLOCALE)
|
#elif defined(HAVE_SETLOCALE)
|
||||||
char* old = setlocale(LC_NUMERIC, locale);
|
char* old = setlocale(LC_NUMERIC, locale);
|
||||||
int res = snprintf(str, size, "%*.g", FLT_DIG, f);
|
int res = snprintf(str, size, "%.*g", FLT_DIG, f);
|
||||||
setlocale(LC_NUMERIC, old);
|
setlocale(LC_NUMERIC, old);
|
||||||
return res;
|
return res;
|
||||||
#else
|
#else
|
||||||
UNUSED(locale);
|
UNUSED(locale);
|
||||||
return snprintf(str, size, "%*.g", FLT_DIG, f);
|
return snprintf(str, size, "%.*g", FLT_DIG, f);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue