comparison lisp/emacs-lisp/float-sup.el @ 110525:e950143ab9e0

* lisp/emacs-lisp/float-sup.el (float-pi): New name for `pi'. (float-e): New name for `e'. (degrees-to-radians, radians-to-degrees): * lisp/calendar/solar.el (solar-longitude): * lisp/calculator.el (calculator-registers, calculator-funcall): * lisp/textmodes/artist.el (artist-spray-random-points): * lisp/play/bubbles.el (bubbles--initialize-images): Use new names.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 19 Sep 2010 11:49:21 +0200
parents 1d1d5d9bd884
children b799d38f522a 376148b31b5e
comparison
equal deleted inserted replaced
110524:bf806d096e9a 110525:e950143ab9e0
32 nil 32 nil
33 (error "Floating point was disabled at compile time")) 33 (error "Floating point was disabled at compile time"))
34 34
35 ;; provide an easy hook to tell if we are running with floats or not. 35 ;; provide an easy hook to tell if we are running with floats or not.
36 ;; define pi and e via math-lib calls. (much less prone to killer typos.) 36 ;; define pi and e via math-lib calls. (much less prone to killer typos.)
37 (defconst pi (* 4 (atan 1)) "The value of Pi (3.1415926...).") 37 (defconst float-pi (* 4 (atan 1)) "The value of Pi (3.1415926...).")
38 (defconst pi float-pi "Obsolete since Emacs-23.3. Use `float-pi' instead.")
38 39
39 ;; It's too inconvenient to make `e' a constant because it's used as 40 (defconst float-e (exp 1) "The value of e (2.7182818...).")
40 ;; a temporary variable all the time. 41 (defvar e float-e "Obsolete since Emacs-23.3. Use `float-e' instead.")
41 (defvar e (exp 1) "The value of e (2.7182818...).")
42 42
43 (defconst degrees-to-radians (/ pi 180.0) 43 (defconst degrees-to-radians (/ float-pi 180.0)
44 "Degrees to radian conversion constant.") 44 "Degrees to radian conversion constant.")
45 (defconst radians-to-degrees (/ 180.0 pi) 45 (defconst radians-to-degrees (/ 180.0 float-pi)
46 "Radian to degree conversion constant.") 46 "Radian to degree conversion constant.")
47 47
48 ;; these expand to a single multiply by a float when byte compiled 48 ;; these expand to a single multiply by a float when byte compiled
49 49
50 (defmacro degrees-to-radians (x) 50 (defmacro degrees-to-radians (x)
51 "Convert ARG from degrees to radians." 51 "Convert ARG from degrees to radians."
52 (list '* (/ pi 180.0) x)) 52 (list '* degrees-to-radians x))
53 (defmacro radians-to-degrees (x) 53 (defmacro radians-to-degrees (x)
54 "Convert ARG from radians to degrees." 54 "Convert ARG from radians to degrees."
55 (list '* (/ 180.0 pi) x)) 55 (list '* radians-to-degrees x))
56 56
57 (provide 'lisp-float-type) 57 (provide 'lisp-float-type)
58 58
59 ;; arch-tag: e7837072-a4af-4d08-9953-8a3e755abf9d 59 ;; arch-tag: e7837072-a4af-4d08-9953-8a3e755abf9d
60 ;;; float-sup.el ends here 60 ;;; float-sup.el ends here