~/LLAMA CPP/llama-cpp-release-b11622-updates-jinja-tojson-for-python-accurate-floats

llama.cpp Release b11622 Updates Jinja tojson for Python-Accurate Floats

llama.cpp release b11622 updates the jinja template engine's tojson function to serialize floating-point numbers accurately, matching Python's behavior. Instead of using a standard C++ stream that limited precision, it now writes the shortest representation that preserves the exact value. This fix ensures consistency in tool definitions, tool-call arguments, and other template outputs when using language models locally. It prevents unexpected precision truncation or formatting discrepancies between Python-based tooling and C++ inference runtimes. Previously, tojson printed floats through a C++ stream resulting in 6 significant digits and omitting decimals like '.0', turning values like 48.858844 into 48.8588. The update applies the same logic used by Python's json.dumps and the string/safe filters for floats.

## BACKGROUND

llama.cpp is an open-source software library that performs inference on various large language models such as Meta's Llama, serving as a core foundation for many local AI applications. Jinja is a popular text-based template engine used heavily in Python ecosystems, which is often integrated into LLM tool-calling architectures to format structured prompts.

## REFERENCES

## KEYWORDS

#llama.cpp#AI#LLM#open-source

$ subscribe --daily

llama.cpp Release b11622 Updates Jinja tojson for Python-Accurate Floats | Daily News