comparison src/floatfns.c @ 91041:bdb3fe0ba9fa

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 866-879) - Merge multi-tty branch - Update from CVS - Merge from emacs--rel--22 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-257
author Miles Bader <miles@gnu.org>
date Thu, 11 Oct 2007 16:22:07 +0000
parents f55f9811f5d7 259a9fdd1450
children 606f2d163a64
comparison
equal deleted inserted replaced
91040:14c4a6aac623 91041:bdb3fe0ba9fa
452 DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0, 452 DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0,
453 doc: /* Return the exponential ARG1 ** ARG2. */) 453 doc: /* Return the exponential ARG1 ** ARG2. */)
454 (arg1, arg2) 454 (arg1, arg2)
455 register Lisp_Object arg1, arg2; 455 register Lisp_Object arg1, arg2;
456 { 456 {
457 double f1, f2; 457 double f1, f2, f3;
458 458
459 CHECK_NUMBER_OR_FLOAT (arg1); 459 CHECK_NUMBER_OR_FLOAT (arg1);
460 CHECK_NUMBER_OR_FLOAT (arg2); 460 CHECK_NUMBER_OR_FLOAT (arg2);
461 if (INTEGERP (arg1) /* common lisp spec */ 461 if (INTEGERP (arg1) /* common lisp spec */
462 && INTEGERP (arg2) /* don't promote, if both are ints, and */ 462 && INTEGERP (arg2) /* don't promote, if both are ints, and */
498 f1 = 1.0; 498 f1 = 1.0;
499 #ifdef FLOAT_CHECK_DOMAIN 499 #ifdef FLOAT_CHECK_DOMAIN
500 else if ((f1 == 0.0 && f2 < 0.0) || (f1 < 0 && f2 != floor(f2))) 500 else if ((f1 == 0.0 && f2 < 0.0) || (f1 < 0 && f2 != floor(f2)))
501 domain_error2 ("expt", arg1, arg2); 501 domain_error2 ("expt", arg1, arg2);
502 #endif 502 #endif
503 IN_FLOAT2 (f1 = pow (f1, f2), "expt", arg1, arg2); 503 IN_FLOAT2 (f3 = pow (f1, f2), "expt", arg1, arg2);
504 return make_float (f1); 504 /* Check for overflow in the result. */
505 if (f1 != 0.0 && f3 == 0.0)
506 range_error ("expt", arg1);
507 return make_float (f3);
505 } 508 }
506 509
507 DEFUN ("log", Flog, Slog, 1, 2, 0, 510 DEFUN ("log", Flog, Slog, 1, 2, 0,
508 doc: /* Return the natural logarithm of ARG. 511 doc: /* Return the natural logarithm of ARG.
509 If the optional argument BASE is given, return log ARG using that base. */) 512 If the optional argument BASE is given, return log ARG using that base. */)