Function: number-to-string
number-to-string is a function defined in data.c.
Signature
(number-to-string NUMBER)
Documentation
Return the decimal representation of NUMBER as a string.
Uses a minus sign if negative. NUMBER may be an integer or a floating point number.
Other relevant functions are documented in the string group.
Probably introduced at or before Emacs version 19.29.
Shortdoc
;; string
(number-to-string 42)
=> "42"
Aliases
Source Code
// Defined in /usr/src/emacs/src/data.c
{
char buffer[max (FLOAT_TO_STRING_BUFSIZE, INT_BUFSIZE_BOUND (EMACS_INT))];
int len;
CHECK_NUMBER (number);
if (BIGNUMP (number))
return bignum_to_string (number, 10);
if (FLOATP (number))
len = float_to_string (buffer, XFLOAT_DATA (number));
else
len = sprintf (buffer, "%"pI"d", XFIXNUM (number));
return make_unibyte_string (buffer, len);
}