* src/data.c (Fnumber_to_string): Handle bignum.
* test/src/data-tests.el (data-tests-number-to-string): New test.
char buffer[max (FLOAT_TO_STRING_BUFSIZE, INT_BUFSIZE_BOUND (EMACS_INT))];
int len;
+ if (BIGNUMP (number))
+ {
+ ptrdiff_t count = SPECPDL_INDEX ();
+ char *str = mpz_get_str (NULL, 10, XBIGNUM (number)->value);
+ record_unwind_protect_ptr (xfree, str);
+ return unbind_to (count, make_unibyte_string (str, strlen (str)));
+ }
+
CHECK_FIXNUM_OR_FLOAT (number);
if (FLOATP (number))
(should-not (fixnump (+ most-positive-fixnum 1)))
(should (bignump (+ most-positive-fixnum 1))))
+(ert-deftest data-tests-number-to-string ()
+ (let* ((s "99999999999999999999999999999")
+ (v (read s)))
+ (should (equal (number-to-string v) s))))
+
;;; data-tests.el ends here