I just found this nice nugget inside SWI-Prolog devel C code:
static char * formatInteger(PL_locale *locale, int div, int radix, bool smll, Number n, Buffer out);
Is there a Prolog predicate equivalent do call this, maybe some
predicate with a name ‘$…’? So that it could be used directly without
a detour over format/2, eliminating the dependency on format/2?
Many languages have this primordially before format/2. I assume
in SWI-Prolog its calling mpz_get_str() from GMP, when GMP is