Mercurial > emacs
comparison src/floatfns.c @ 1512:bef6b6903528
* floatfns.c (Flog): Don't forget to declare the BASE argument a
Lisp_Object.
* floatfns.c (Fexpt): Don't return the value of the XSET function
call; that's not guaranteed to be the value assigned.
| author | Jim Blandy <jimb@redhat.com> |
|---|---|
| date | Sat, 31 Oct 1992 05:19:58 +0000 |
| parents | 70ed307d9047 |
| children | cd23f7ef1bd0 |
comparison
equal
deleted
inserted
replaced
| 1511:ff88f962a982 | 1512:bef6b6903528 |
|---|---|
| 290 else | 290 else |
| 291 { | 291 { |
| 292 for (; y > 0; y--) | 292 for (; y > 0; y--) |
| 293 acc *= x; | 293 acc *= x; |
| 294 } | 294 } |
| 295 return XSET (x, Lisp_Int, acc); | 295 XFASTINT (x) = acc; |
| 296 return x; | |
| 296 } | 297 } |
| 297 f1 = (XTYPE (num1) == Lisp_Float) ? XFLOAT (num1)->data : XINT (num1); | 298 f1 = (XTYPE (num1) == Lisp_Float) ? XFLOAT (num1)->data : XINT (num1); |
| 298 f2 = (XTYPE (num2) == Lisp_Float) ? XFLOAT (num2)->data : XINT (num2); | 299 f2 = (XTYPE (num2) == Lisp_Float) ? XFLOAT (num2)->data : XINT (num2); |
| 299 IN_FLOAT (f1 = pow (f1, f2), num1); | 300 IN_FLOAT (f1 = pow (f1, f2), num1); |
| 300 return make_float (f1); | 301 return make_float (f1); |
| 302 | 303 |
| 303 DEFUN ("log", Flog, Slog, 1, 2, 0, | 304 DEFUN ("log", Flog, Slog, 1, 2, 0, |
| 304 "Return the natural logarithm of NUM. | 305 "Return the natural logarithm of NUM. |
| 305 If second optional argument BASE is given, return log NUM using that base.") | 306 If second optional argument BASE is given, return log NUM using that base.") |
| 306 (num, base) | 307 (num, base) |
| 307 register Lisp_Object num; | 308 register Lisp_Object num, base; |
| 308 { | 309 { |
| 309 double d = extract_float (num); | 310 double d = extract_float (num); |
| 310 | 311 |
| 311 if (NILP (base)) | 312 if (NILP (base)) |
| 312 IN_FLOAT (d = log (d), num); | 313 IN_FLOAT (d = log (d), num); |
