Mercurial > emacs
comparison lispref/numbers.texi @ 77006:1f4b88ab053d
Improve index entries. Remove redundant/useless ones.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 07 Apr 2007 02:06:21 +0000 |
parents | 4f96f3f74c69 |
children | a1e16e813aed 4ef881a120fe |
comparison
equal
deleted
inserted
replaced
77005:2122b5496349 | 77006:1f4b88ab053d |
---|---|
266 @code{(zerop x)} is equivalent to @code{(= x 0)}. | 266 @code{(zerop x)} is equivalent to @code{(= x 0)}. |
267 @end defun | 267 @end defun |
268 | 268 |
269 @node Comparison of Numbers | 269 @node Comparison of Numbers |
270 @section Comparison of Numbers | 270 @section Comparison of Numbers |
271 @cindex number equality | |
272 @cindex number comparison | 271 @cindex number comparison |
273 @cindex compare numbers | 272 @cindex comparing numbers |
274 | 273 |
275 To test numbers for numerical equality, you should normally use | 274 To test numbers for numerical equality, you should normally use |
276 @code{=}, not @code{eq}. There can be many distinct floating point | 275 @code{=}, not @code{eq}. There can be many distinct floating point |
277 number objects with the same numeric value. If you use @code{eq} to | 276 number objects with the same numeric value. If you use @code{eq} to |
278 compare them, then you test whether two values are the same | 277 compare them, then you test whether two values are the same |
389 @end defun | 388 @end defun |
390 | 389 |
391 @node Numeric Conversions | 390 @node Numeric Conversions |
392 @section Numeric Conversions | 391 @section Numeric Conversions |
393 @cindex rounding in conversions | 392 @cindex rounding in conversions |
394 @cindex numeric conversions | 393 @cindex number conversions |
395 @cindex convert number | 394 @cindex converting numbers |
396 | 395 |
397 To convert an integer to floating point, use the function @code{float}. | 396 To convert an integer to floating point, use the function @code{float}. |
398 | 397 |
399 @defun float number | 398 @defun float number |
400 This returns @var{number} converted to floating point. | 399 This returns @var{number} converted to floating point. |
736 and returns that value as a floating point number. | 735 and returns that value as a floating point number. |
737 @end defun | 736 @end defun |
738 | 737 |
739 @node Bitwise Operations | 738 @node Bitwise Operations |
740 @section Bitwise Operations on Integers | 739 @section Bitwise Operations on Integers |
740 @cindex bitwise arithmetic | |
741 @cindex logical arithmetic | |
741 | 742 |
742 In a computer, an integer is represented as a binary number, a | 743 In a computer, an integer is represented as a binary number, a |
743 sequence of @dfn{bits} (digits which are either zero or one). A bitwise | 744 sequence of @dfn{bits} (digits which are either zero or one). A bitwise |
744 operation acts on the individual bits of such a sequence. For example, | 745 operation acts on the individual bits of such a sequence. For example, |
745 @dfn{shifting} moves the whole sequence left or right one or more places, | 746 @dfn{shifting} moves the whole sequence left or right one or more places, |
917 @end group | 918 @end group |
918 @end smallexample | 919 @end smallexample |
919 @end defun | 920 @end defun |
920 | 921 |
921 @defun logand &rest ints-or-markers | 922 @defun logand &rest ints-or-markers |
922 @cindex logical and | |
923 @cindex bitwise and | |
924 This function returns the ``logical and'' of the arguments: the | 923 This function returns the ``logical and'' of the arguments: the |
925 @var{n}th bit is set in the result if, and only if, the @var{n}th bit is | 924 @var{n}th bit is set in the result if, and only if, the @var{n}th bit is |
926 set in all the arguments. (``Set'' means that the value of the bit is 1 | 925 set in all the arguments. (``Set'' means that the value of the bit is 1 |
927 rather than 0.) | 926 rather than 0.) |
928 | 927 |
970 @end group | 969 @end group |
971 @end smallexample | 970 @end smallexample |
972 @end defun | 971 @end defun |
973 | 972 |
974 @defun logior &rest ints-or-markers | 973 @defun logior &rest ints-or-markers |
975 @cindex logical inclusive or | |
976 @cindex bitwise or | |
977 This function returns the ``inclusive or'' of its arguments: the @var{n}th bit | 974 This function returns the ``inclusive or'' of its arguments: the @var{n}th bit |
978 is set in the result if, and only if, the @var{n}th bit is set in at least | 975 is set in the result if, and only if, the @var{n}th bit is set in at least |
979 one of the arguments. If there are no arguments, the result is zero, | 976 one of the arguments. If there are no arguments, the result is zero, |
980 which is an identity element for this operation. If @code{logior} is | 977 which is an identity element for this operation. If @code{logior} is |
981 passed just one argument, it returns that argument. | 978 passed just one argument, it returns that argument. |
997 @end group | 994 @end group |
998 @end smallexample | 995 @end smallexample |
999 @end defun | 996 @end defun |
1000 | 997 |
1001 @defun logxor &rest ints-or-markers | 998 @defun logxor &rest ints-or-markers |
1002 @cindex bitwise exclusive or | |
1003 @cindex logical exclusive or | |
1004 This function returns the ``exclusive or'' of its arguments: the | 999 This function returns the ``exclusive or'' of its arguments: the |
1005 @var{n}th bit is set in the result if, and only if, the @var{n}th bit is | 1000 @var{n}th bit is set in the result if, and only if, the @var{n}th bit is |
1006 set in an odd number of the arguments. If there are no arguments, the | 1001 set in an odd number of the arguments. If there are no arguments, the |
1007 result is 0, which is an identity element for this operation. If | 1002 result is 0, which is an identity element for this operation. If |
1008 @code{logxor} is passed just one argument, it returns that argument. | 1003 @code{logxor} is passed just one argument, it returns that argument. |
1024 @end group | 1019 @end group |
1025 @end smallexample | 1020 @end smallexample |
1026 @end defun | 1021 @end defun |
1027 | 1022 |
1028 @defun lognot integer | 1023 @defun lognot integer |
1029 @cindex logical not | |
1030 @cindex bitwise not | |
1031 This function returns the logical complement of its argument: the @var{n}th | 1024 This function returns the logical complement of its argument: the @var{n}th |
1032 bit is one in the result if, and only if, the @var{n}th bit is zero in | 1025 bit is one in the result if, and only if, the @var{n}th bit is zero in |
1033 @var{integer}, and vice-versa. | 1026 @var{integer}, and vice-versa. |
1034 | 1027 |
1035 @example | 1028 @example |