Mercurial > emacs
comparison src/floatfns.c @ 40656:cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
| author | Pavel Jan?k <Pavel@Janik.cz> |
|---|---|
| date | Fri, 02 Nov 2001 20:46:55 +0000 |
| parents | a9c8422074c9 |
| children | a17c8b15ef1b |
comparison
equal
deleted
inserted
replaced
| 40655:45453187feeb | 40656:cdfd4d09b79a |
|---|---|
| 216 | 216 |
| 217 double | 217 double |
| 218 extract_float (num) | 218 extract_float (num) |
| 219 Lisp_Object num; | 219 Lisp_Object num; |
| 220 { | 220 { |
| 221 CHECK_NUMBER_OR_FLOAT (num, 0); | 221 CHECK_NUMBER_OR_FLOAT (num); |
| 222 | 222 |
| 223 if (FLOATP (num)) | 223 if (FLOATP (num)) |
| 224 return XFLOAT_DATA (num); | 224 return XFLOAT_DATA (num); |
| 225 return (double) XINT (num); | 225 return (double) XINT (num); |
| 226 } | 226 } |
| 443 (arg1, arg2) | 443 (arg1, arg2) |
| 444 register Lisp_Object arg1, arg2; | 444 register Lisp_Object arg1, arg2; |
| 445 { | 445 { |
| 446 double f1, f2; | 446 double f1, f2; |
| 447 | 447 |
| 448 CHECK_NUMBER_OR_FLOAT (arg1, 0); | 448 CHECK_NUMBER_OR_FLOAT (arg1); |
| 449 CHECK_NUMBER_OR_FLOAT (arg2, 0); | 449 CHECK_NUMBER_OR_FLOAT (arg2); |
| 450 if (INTEGERP (arg1) /* common lisp spec */ | 450 if (INTEGERP (arg1) /* common lisp spec */ |
| 451 && INTEGERP (arg2)) /* don't promote, if both are ints */ | 451 && INTEGERP (arg2)) /* don't promote, if both are ints */ |
| 452 { /* this can be improved by pre-calculating */ | 452 { /* this can be improved by pre-calculating */ |
| 453 EMACS_INT acc, x, y; /* some binary powers of x then accumulating */ | 453 EMACS_INT acc, x, y; /* some binary powers of x then accumulating */ |
| 454 Lisp_Object val; | 454 Lisp_Object val; |
| 644 DEFUN ("abs", Fabs, Sabs, 1, 1, 0, | 644 DEFUN ("abs", Fabs, Sabs, 1, 1, 0, |
| 645 "Return the absolute value of ARG.") | 645 "Return the absolute value of ARG.") |
| 646 (arg) | 646 (arg) |
| 647 register Lisp_Object arg; | 647 register Lisp_Object arg; |
| 648 { | 648 { |
| 649 CHECK_NUMBER_OR_FLOAT (arg, 0); | 649 CHECK_NUMBER_OR_FLOAT (arg); |
| 650 | 650 |
| 651 if (FLOATP (arg)) | 651 if (FLOATP (arg)) |
| 652 IN_FLOAT (arg = make_float (fabs (XFLOAT_DATA (arg))), "abs", arg); | 652 IN_FLOAT (arg = make_float (fabs (XFLOAT_DATA (arg))), "abs", arg); |
| 653 else if (XINT (arg) < 0) | 653 else if (XINT (arg) < 0) |
| 654 XSETINT (arg, - XINT (arg)); | 654 XSETINT (arg, - XINT (arg)); |
| 659 DEFUN ("float", Ffloat, Sfloat, 1, 1, 0, | 659 DEFUN ("float", Ffloat, Sfloat, 1, 1, 0, |
| 660 "Return the floating point number equal to ARG.") | 660 "Return the floating point number equal to ARG.") |
| 661 (arg) | 661 (arg) |
| 662 register Lisp_Object arg; | 662 register Lisp_Object arg; |
| 663 { | 663 { |
| 664 CHECK_NUMBER_OR_FLOAT (arg, 0); | 664 CHECK_NUMBER_OR_FLOAT (arg); |
| 665 | 665 |
| 666 if (INTEGERP (arg)) | 666 if (INTEGERP (arg)) |
| 667 return make_float ((double) XINT (arg)); | 667 return make_float ((double) XINT (arg)); |
| 668 else /* give 'em the same float back */ | 668 else /* give 'em the same float back */ |
| 669 return arg; | 669 return arg; |
| 725 register Lisp_Object arg, divisor; | 725 register Lisp_Object arg, divisor; |
| 726 double (*double_round) (); | 726 double (*double_round) (); |
| 727 EMACS_INT (*int_round2) (); | 727 EMACS_INT (*int_round2) (); |
| 728 char *name; | 728 char *name; |
| 729 { | 729 { |
| 730 CHECK_NUMBER_OR_FLOAT (arg, 0); | 730 CHECK_NUMBER_OR_FLOAT (arg); |
| 731 | 731 |
| 732 if (! NILP (divisor)) | 732 if (! NILP (divisor)) |
| 733 { | 733 { |
| 734 EMACS_INT i1, i2; | 734 EMACS_INT i1, i2; |
| 735 | 735 |
| 736 CHECK_NUMBER_OR_FLOAT (divisor, 1); | 736 CHECK_NUMBER_OR_FLOAT (divisor); |
| 737 | 737 |
| 738 if (FLOATP (arg) || FLOATP (divisor)) | 738 if (FLOATP (arg) || FLOATP (divisor)) |
| 739 { | 739 { |
| 740 double f1, f2; | 740 double f1, f2; |
| 741 | 741 |
