comparison src/doprnt.c @ 5252:378a34562cbe

Fix style, documentation for rounding functions and multiple values. src/ChangeLog addition: 2010-08-30 Aidan Kehoe <kehoea@parhasard.net> * floatfns.c (ceiling_one_mundane_arg, floor_one_mundane_arg) (round_one_mundane_arg, truncate_one_mundane_arg): INTEGERP is always available, no need to wrap calls to it with #ifdef HAVE_BIGNUM. (Fceiling, Ffloor, Fround, Ftruncate, Ffceiling, Fffloor) (Ffround, Fftruncate): Correct some code formatting here. * doprnt.c (emacs_doprnt_1): Remove some needless #ifdef WITH_NUMBER_TYPES, now number.h is always #included. man/ChangeLog addition: 2010-08-30 Aidan Kehoe <kehoea@parhasard.net> * lispref/eval.texi (Evaluation, Multiple values): Document our implementation of multiple values; point the reader to the CLTL or the Hyperspec for details of exactly when values are discarded. * lispref/numbers.texi (Numeric Conversions): Document the optional DIVISOR arguments to the rounding functions, and document that they all return multiple values. (Rounding Operations): Ditto. * cl.texi (Multiple Values): Document that we've moved the multiple values implementation to core code, and cross-reference to the Lispref. (Numerical Functions): The various rounding functions are now identical to the built-in rounding functions, with the exception that they return lists, not multiple values; document this.
author Aidan Kehoe <kehoea@parhasard.net>
date Mon, 30 Aug 2010 15:23:42 +0100
parents 16112448d484
children 308d34e9f07d
comparison
equal deleted inserted replaced
5251:b0ba3598beb1 5252:378a34562cbe
589 else 589 else
590 { 590 {
591 Lisp_Object obj = largs[spec->argnum - 1]; 591 Lisp_Object obj = largs[spec->argnum - 1];
592 if (CHARP (obj)) 592 if (CHARP (obj))
593 obj = make_int (XCHAR (obj)); 593 obj = make_int (XCHAR (obj));
594 #ifdef WITH_NUMBER_TYPES
595 if (!NUMBERP (obj)) 594 if (!NUMBERP (obj))
596 #else
597 if (!INT_OR_FLOATP (obj))
598 #endif
599 { 595 {
600 /* WARNING! This MUST be big enough for the sprintf below */ 596 /* WARNING! This MUST be big enough for the sprintf below */
601 CIbyte msg[48]; 597 CIbyte msg[48];
602 sprintf (msg, 598 sprintf (msg,
603 "format specifier %%%c doesn't match argument type", 599 "format specifier %%%c doesn't match argument type",
604 ch); 600 ch);
605 syntax_error (msg, Qunbound); 601 syntax_error (msg, Qunbound);
606 } 602 }
607 else if (strchr (double_converters, ch)) 603 else if (strchr (double_converters, ch))
608 { 604 {
609 #ifdef WITH_NUMBER_TYPES 605 if (INTP (obj))
610 if (INTP (obj) || FLOATP (obj)) 606 arg.d = XINT (obj);
611 arg.d = XFLOATINT (obj); 607 else if (FLOATP (obj))
608 arg.d = XFLOAT_DATA (obj);
612 #ifdef HAVE_BIGNUM 609 #ifdef HAVE_BIGNUM
613 else if (BIGNUMP (obj)) 610 else if (BIGNUMP (obj))
614 arg.d = bignum_to_double (XBIGNUM_DATA (obj)); 611 arg.d = bignum_to_double (XBIGNUM_DATA (obj));
615 #endif 612 #endif
616 #ifdef HAVE_RATIO 613 #ifdef HAVE_RATIO
629 case 'g': ch = 'k'; break; 626 case 'g': ch = 'k'; break;
630 case 'G': ch = 'K'; break; 627 case 'G': ch = 'K'; break;
631 } 628 }
632 } 629 }
633 #endif 630 #endif
634 #else /* !WITH_NUMBER_TYPES */
635 arg.d = XFLOATINT (obj);
636 #endif /* WITH_NUMBER_TYPES */
637 } 631 }
638 else 632 else
639 { 633 {
640 if (FLOATP (obj)) 634 if (FLOATP (obj))
641 obj = Ftruncate (obj, Qnil); 635 obj = Ftruncate (obj, Qnil);