Mercurial > emacs
comparison lispref/numbers.texi @ 25751:467b88fab665
*** empty log message ***
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 17 Sep 1999 06:59:04 +0000 |
parents | 80ac191b6d2b |
children | d2e5f1b7d8e2 |
comparison
equal
deleted
inserted
replaced
25750:f1968a807f56 | 25751:467b88fab665 |
---|---|
38 minimum range is @minus{}134217728 to 134217727 (28 bits; i.e., | 38 minimum range is @minus{}134217728 to 134217727 (28 bits; i.e., |
39 @ifinfo | 39 @ifinfo |
40 -2**27 | 40 -2**27 |
41 @end ifinfo | 41 @end ifinfo |
42 @tex | 42 @tex |
43 $-2^{27}$ | 43 @math{-2^{27}} |
44 @end tex | 44 @end tex |
45 to | 45 to |
46 @ifinfo | 46 @ifinfo |
47 2**27 - 1), | 47 2**27 - 1), |
48 @end ifinfo | 48 @end ifinfo |
49 @tex | 49 @tex |
50 $2^{27}-1$), | 50 @math{2^{27}-1}), |
51 @end tex | 51 @end tex |
52 but some machines may provide a wider range. Many examples in this | 52 but some machines may provide a wider range. Many examples in this |
53 chapter assume an integer has 28 bits. | 53 chapter assume an integer has 28 bits. |
54 @cindex overflow | 54 @cindex overflow |
55 | 55 |
310 otherwise. | 310 otherwise. |
311 @end defun | 311 @end defun |
312 | 312 |
313 @defun max number-or-marker &rest numbers-or-markers | 313 @defun max number-or-marker &rest numbers-or-markers |
314 This function returns the largest of its arguments. | 314 This function returns the largest of its arguments. |
315 If any of the argument is floating-point, the value is returned | |
316 as floating point, even if it was given as an integer. | |
315 | 317 |
316 @example | 318 @example |
317 (max 20) | 319 (max 20) |
318 @result{} 20 | 320 @result{} 20 |
319 (max 1 2.5) | 321 (max 1 2.5) |
320 @result{} 2.5 | 322 @result{} 2.5 |
321 (max 1 3 2.5) | 323 (max 1 3 2.5) |
322 @result{} 3 | 324 @result{} 3.0 |
323 @end example | 325 @end example |
324 @end defun | 326 @end defun |
325 | 327 |
326 @defun min number-or-marker &rest numbers-or-markers | 328 @defun min number-or-marker &rest numbers-or-markers |
327 This function returns the smallest of its arguments. | 329 This function returns the smallest of its arguments. |
330 If any of the argument is floating-point, the value is returned | |
331 as floating point, even if it was given as an integer. | |
328 | 332 |
329 @example | 333 @example |
330 (min -4 1) | 334 (min -4 1) |
331 @result{} -4 | 335 @result{} -4 |
332 @end example | 336 @end example |
956 The value of @code{(asin @var{arg})} is a number between | 960 The value of @code{(asin @var{arg})} is a number between |
957 @ifinfo | 961 @ifinfo |
958 @minus{}pi/2 | 962 @minus{}pi/2 |
959 @end ifinfo | 963 @end ifinfo |
960 @tex | 964 @tex |
961 $-\pi/2$ | 965 @math{-\pi/2} |
962 @end tex | 966 @end tex |
963 and | 967 and |
964 @ifinfo | 968 @ifinfo |
965 pi/2 | 969 pi/2 |
966 @end ifinfo | 970 @end ifinfo |
967 @tex | 971 @tex |
968 $\pi/2$ | 972 @math{\pi/2} |
969 @end tex | 973 @end tex |
970 (inclusive) whose sine is @var{arg}; if, however, @var{arg} | 974 (inclusive) whose sine is @var{arg}; if, however, @var{arg} |
971 is out of range (outside [-1, 1]), then the result is a NaN. | 975 is out of range (outside [-1, 1]), then the result is a NaN. |
972 @end defun | 976 @end defun |
973 | 977 |
975 The value of @code{(acos @var{arg})} is a number between 0 and | 979 The value of @code{(acos @var{arg})} is a number between 0 and |
976 @ifinfo | 980 @ifinfo |
977 pi | 981 pi |
978 @end ifinfo | 982 @end ifinfo |
979 @tex | 983 @tex |
980 $\pi$ | 984 @math{\pi} |
981 @end tex | 985 @end tex |
982 (inclusive) whose cosine is @var{arg}; if, however, @var{arg} | 986 (inclusive) whose cosine is @var{arg}; if, however, @var{arg} |
983 is out of range (outside [-1, 1]), then the result is a NaN. | 987 is out of range (outside [-1, 1]), then the result is a NaN. |
984 @end defun | 988 @end defun |
985 | 989 |
987 The value of @code{(atan @var{arg})} is a number between | 991 The value of @code{(atan @var{arg})} is a number between |
988 @ifinfo | 992 @ifinfo |
989 @minus{}pi/2 | 993 @minus{}pi/2 |
990 @end ifinfo | 994 @end ifinfo |
991 @tex | 995 @tex |
992 $-\pi/2$ | 996 @math{-\pi/2} |
993 @end tex | 997 @end tex |
994 and | 998 and |
995 @ifinfo | 999 @ifinfo |
996 pi/2 | 1000 pi/2 |
997 @end ifinfo | 1001 @end ifinfo |
998 @tex | 1002 @tex |
999 $\pi/2$ | 1003 @math{\pi/2} |
1000 @end tex | 1004 @end tex |
1001 (exclusive) whose tangent is @var{arg}. | 1005 (exclusive) whose tangent is @var{arg}. |
1002 @end defun | 1006 @end defun |
1003 | 1007 |
1004 @defun exp arg | 1008 @defun exp arg |
1005 This is the exponential function; it returns | 1009 This is the exponential function; it returns |
1006 @tex | 1010 @tex |
1007 $e$ | 1011 @math{e} |
1008 @end tex | 1012 @end tex |
1009 @ifinfo | 1013 @ifinfo |
1010 @i{e} | 1014 @i{e} |
1011 @end ifinfo | 1015 @end ifinfo |
1012 to the power @var{arg}. | 1016 to the power @var{arg}. |
1013 @tex | 1017 @tex |
1014 $e$ | 1018 @math{e} |
1015 @end tex | 1019 @end tex |
1016 @ifinfo | 1020 @ifinfo |
1017 @i{e} | 1021 @i{e} |
1018 @end ifinfo | 1022 @end ifinfo |
1019 is a fundamental mathematical constant also called the base of natural | 1023 is a fundamental mathematical constant also called the base of natural |
1022 | 1026 |
1023 @defun log arg &optional base | 1027 @defun log arg &optional base |
1024 This function returns the logarithm of @var{arg}, with base @var{base}. | 1028 This function returns the logarithm of @var{arg}, with base @var{base}. |
1025 If you don't specify @var{base}, the base | 1029 If you don't specify @var{base}, the base |
1026 @tex | 1030 @tex |
1027 $e$ | 1031 @math{e} |
1028 @end tex | 1032 @end tex |
1029 @ifinfo | 1033 @ifinfo |
1030 @i{e} | 1034 @i{e} |
1031 @end ifinfo | 1035 @end ifinfo |
1032 is used. If @var{arg} | 1036 is used. If @var{arg} |
1083 the same in each Emacs run! For example, in one operating system, the | 1087 the same in each Emacs run! For example, in one operating system, the |
1084 first call to @code{(random)} after you start Emacs always returns | 1088 first call to @code{(random)} after you start Emacs always returns |
1085 -1457731, and the second one always returns -7692030. This | 1089 -1457731, and the second one always returns -7692030. This |
1086 repeatability is helpful for debugging. | 1090 repeatability is helpful for debugging. |
1087 | 1091 |
1088 If you want truly unpredictable random numbers, execute @code{(random | 1092 If you want random numbers that don't always come out the same, execute |
1089 t)}. This chooses a new seed based on the current time of day and on | 1093 @code{(random t)}. This chooses a new seed based on the current time of |
1090 Emacs's process @sc{id} number. | 1094 day and on Emacs's process @sc{id} number. |
1091 | 1095 |
1092 @defun random &optional limit | 1096 @defun random &optional limit |
1093 This function returns a pseudo-random integer. Repeated calls return a | 1097 This function returns a pseudo-random integer. Repeated calls return a |
1094 series of pseudo-random integers. | 1098 series of pseudo-random integers. |
1095 | 1099 |