Fix locale-dependent float printing in GGUF metadata (#17331)

* Set C locale for consistent float formatting across all binaries.

* Add C locale setting to all tools binaries

Add std::setlocale(LC_NUMERIC, "C") to all 16 binaries in the tools/
directory to ensure consistent floating-point formatting.

* Apply suggestion from @JohannesGaessler

---------

Co-authored-by: Johannes Gäßler <johannesg@5d6.de>
This commit is contained in:
SamareshSingh
2026-03-04 02:30:40 -06:00
committed by GitHub
parent 54910bd4f3
commit cb8f4fa3f8
39 changed files with 140 additions and 19 deletions
+3
View File
@@ -2,6 +2,7 @@
//#include "log.h" // TODO: start using log.h
#include "llama.h"
#include <clocale>
#include <cstdio>
#include <cstring>
#include <fstream>
@@ -184,6 +185,8 @@ static void write_utf8_cstr_to_stdout(const char * str, bool & invalid_utf8) {
}
int main(int raw_argc, char ** raw_argv) {
std::setlocale(LC_NUMERIC, "C");
const std::vector<std::string> argv = ingest_args(raw_argc, raw_argv);
const int argc = argv.size();