comparison lisp/calculator.el @ 94389:c8cc1acc029f

(calculator-expt): Modify previous change to just use the expanded cl definition of oddp.
author Glenn Morris <rgm@gnu.org>
date Sun, 27 Apr 2008 01:26:57 +0000
parents 7d261daf53c6
children ce5d820c626f
comparison
equal deleted inserted replaced
94388:7d261daf53c6 94389:c8cc1acc029f
3 ;; Copyright (C) 1998, 2000, 2001, 2002, 2003, 2004, 3 ;; Copyright (C) 1998, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. 4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
5 5
6 ;; Author: Eli Barzilay <eli@barzilay.org> 6 ;; Author: Eli Barzilay <eli@barzilay.org>
7 ;; Keywords: tools, convenience 7 ;; Keywords: tools, convenience
8 ;; Time-stamp: <Sat 26-Apr-2008 18:18:44 gm on grasmoor> 8 ;; Time-stamp: <Sat 26-Apr-2008 18:25:36 gm on grasmoor>
9 9
10 ;; This file is part of GNU Emacs. 10 ;; This file is part of GNU Emacs.
11 11
12 ;; GNU Emacs is free software; you can redistribute it and/or modify it 12 ;; GNU Emacs is free software; you can redistribute it and/or modify it
13 ;; under the terms of the GNU General Public License as published by the 13 ;; under the terms of the GNU General Public License as published by the
1793 (cond 1793 (cond
1794 ((and (< x 1.0) (> x -1.0)) 1794 ((and (< x 1.0) (> x -1.0))
1795 ;; For small x, the range error comes from large y. 1795 ;; For small x, the range error comes from large y.
1796 0.0) 1796 0.0)
1797 ((and (> x 0.0) (< y 0.0)) 1797 ((and (> x 0.0) (< y 0.0))
1798 ;; For large positive x and negative y, the range error 1798 ;; For large positive x and negative y, the range error
1799 ;; comes from large negative y. 1799 ;; comes from large negative y.
1800 0.0) 1800 0.0)
1801 ((and (> x 0.0) (> y 0.0)) 1801 ((and (> x 0.0) (> y 0.0))
1802 ;; For large positive x and positive y, the range error 1802 ;; For large positive x and positive y, the range error
1803 ;; comes from large y. 1803 ;; comes from large y.
1804 1.0e+INF) 1804 1.0e+INF)
1805 ;; For the rest, x must be large and negative. 1805 ;; For the rest, x must be large and negative.
1806 ;; The range errors come from large integer y. 1806 ;; The range errors come from large integer y.
1807 ((< y 0.0) 1807 ((< y 0.0)
1808 0.0) 1808 0.0)
1809 ((not (zerop (% (truncate y) 2))) 1809 ((eq (logand (truncate y) 1) 1) ; expansion of cl `oddp'
1810 ;; If y is odd 1810 ;; If y is odd
1811 -1.0e+INF) 1811 -1.0e+INF)
1812 (t 1812 (t
1813 ;; 1813 ;;
1814 1.0e+INF))) 1814 1.0e+INF)))