comparison lisp/emacs-lisp/float-sup.el @ 110533:b799d38f522a

Merge changes from emacs-23 branch
author Chong Yidong <cyd@stupidchicken.com>
date Thu, 23 Sep 2010 15:00:31 -0400
parents 280c8ae2476d e950143ab9e0
children aac9726c8e54
comparison
equal deleted inserted replaced
110506:2cac83f5f8bc 110533:b799d38f522a
33 nil 33 nil
34 (error "Floating point was disabled at compile time")) 34 (error "Floating point was disabled at compile time"))
35 35
36 ;; provide an easy hook to tell if we are running with floats or not. 36 ;; provide an easy hook to tell if we are running with floats or not.
37 ;; define pi and e via math-lib calls. (much less prone to killer typos.) 37 ;; define pi and e via math-lib calls. (much less prone to killer typos.)
38 (defconst pi (* 4 (atan 1)) "The value of Pi (3.1415926...).") 38 (defconst float-pi (* 4 (atan 1)) "The value of Pi (3.1415926...).")
39 (defconst pi float-pi "Obsolete since Emacs-23.3. Use `float-pi' instead.")
39 40
40 ;; It's too inconvenient to make `e' a constant because it's used as 41 (defconst float-e (exp 1) "The value of e (2.7182818...).")
41 ;; a temporary variable all the time. 42 (defvar e float-e "Obsolete since Emacs-23.3. Use `float-e' instead.")
42 (defvar e (exp 1) "The value of e (2.7182818...).")
43 43
44 (defconst degrees-to-radians (/ pi 180.0) 44 (defconst degrees-to-radians (/ float-pi 180.0)
45 "Degrees to radian conversion constant.") 45 "Degrees to radian conversion constant.")
46 (defconst radians-to-degrees (/ 180.0 pi) 46 (defconst radians-to-degrees (/ 180.0 float-pi)
47 "Radian to degree conversion constant.") 47 "Radian to degree conversion constant.")
48 48
49 ;; these expand to a single multiply by a float when byte compiled 49 ;; these expand to a single multiply by a float when byte compiled
50 50
51 (defmacro degrees-to-radians (x) 51 (defmacro degrees-to-radians (x)
52 "Convert ARG from degrees to radians." 52 "Convert ARG from degrees to radians."
53 (list '* (/ pi 180.0) x)) 53 (list '* degrees-to-radians x))
54 (defmacro radians-to-degrees (x) 54 (defmacro radians-to-degrees (x)
55 "Convert ARG from radians to degrees." 55 "Convert ARG from radians to degrees."
56 (list '* (/ 180.0 pi) x)) 56 (list '* radians-to-degrees x))
57 57
58 (provide 'lisp-float-type) 58 (provide 'lisp-float-type)
59 59
60 ;; arch-tag: e7837072-a4af-4d08-9953-8a3e755abf9d 60 ;; arch-tag: e7837072-a4af-4d08-9953-8a3e755abf9d
61 ;;; float-sup.el ends here 61 ;;; float-sup.el ends here