diff --git a/pd/src/m_atom.c b/pd/src/m_atom.c index 3c4f5be2e6ca5af73cba8ef78362b426052cb960..75f723d515f2dd781c74d30dabc025c844b999d4 100644 --- a/pd/src/m_atom.c +++ b/pd/src/m_atom.c @@ -8,6 +8,13 @@ #define DOLLARALL -0x7fffffff /* defined in m_binbuf.c, too. Consider merging */ + +#if PD_FLOATSIZE == 32 +#define M_ATOM_FLOAT_SPECIFIER "%.6g" +#elif PD_FLOATSIZE == 64 +#define M_ATOM_FLOAT_SPECIFIER "%.14lg" +#endif + /* convenience routines for checking and getting values of atoms. There's no "pointer" version since there's nothing safe to return if there's an error. */ @@ -85,7 +92,7 @@ void atom_string(t_atom *a, char *buf, unsigned int bufsize) strcpy(buf, "(pointer)"); break; case A_FLOAT: - sprintf(tbuf, "%g", a->a_w.w_float); + sprintf(tbuf, M_ATOM_FLOAT_SPECIFIER, a->a_w.w_float); if (strlen(tbuf) < bufsize-1) strcpy(buf, tbuf); else if (a->a_w.w_float < 0) strcpy(buf, "-"); else strcat(buf, "+");