aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorPaul Eggert2014-03-19 14:21:01 -0700
committerPaul Eggert2014-03-19 14:21:01 -0700
commitc7dff2f665bf3fba126caef45b88c6b4db4f5c66 (patch)
tree05fd459449129a498c6c11b803579d46ba6df308 /doc
parentd16ae6228826c561bdb3701bd65d7517bd9e30d5 (diff)
downloademacs-c7dff2f665bf3fba126caef45b88c6b4db4f5c66.tar.gz
emacs-c7dff2f665bf3fba126caef45b88c6b4db4f5c66.zip
* numbers.texi: Improve and clarify a bit, and fix some minor bugs.
Remove now-obsolete hypothetical note about negative division, as the C standard has changed.
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/ChangeLog4
-rw-r--r--doc/lispref/numbers.texi42
2 files changed, 23 insertions, 23 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 25c4744c855..fb79a74405b 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,5 +1,9 @@
12014-03-19 Paul Eggert <eggert@cs.ucla.edu> 12014-03-19 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 * numbers.texi: Improve and clarify a bit, and fix some minor bugs.
4 Remove now-obsolete hypothetical note about negative division,
5 as the C standard has changed.
6
3 Fix porting inconsistency about rounding to even. 7 Fix porting inconsistency about rounding to even.
4 * numbers.texi (Numeric Conversions, Rounding Operations): 8 * numbers.texi (Numeric Conversions, Rounding Operations):
5 Document that 'round' and 'fround' round to even. 9 Document that 'round' and 'fround' round to even.
diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi
index 5526ea0860a..5da950e1601 100644
--- a/doc/lispref/numbers.texi
+++ b/doc/lispref/numbers.texi
@@ -116,8 +116,8 @@ use the @samp{...} notation to make binary integers easier to read.)
116@minus{}1 is represented as 30 ones. (This is called @dfn{two's 116@minus{}1 is represented as 30 ones. (This is called @dfn{two's
117complement} notation.) 117complement} notation.)
118 118
119 The negative integer, @minus{}5, is creating by subtracting 4 from 119 Subtracting 4 from @minus{}1 returns the negative integer @minus{}5.
120@minus{}1. In binary, the decimal integer 4 is 100. Consequently, 120In binary, the decimal integer 4 is 100. Consequently,
121@minus{}5 looks like this: 121@minus{}5 looks like this:
122 122
123@example 123@example
@@ -190,8 +190,8 @@ on 64-bit platforms.
190@end defvar 190@end defvar
191 191
192 In Emacs Lisp, text characters are represented by integers. Any 192 In Emacs Lisp, text characters are represented by integers. Any
193integer between zero and the value of @code{max-char}, inclusive, is 193integer between zero and the value of @code{(max-char)}, inclusive, is
194considered to be valid as a character. @xref{String Basics}. 194considered to be valid as a character. @xref{Character Codes}.
195 195
196@node Float Basics 196@node Float Basics
197@section Floating-Point Basics 197@section Floating-Point Basics
@@ -252,7 +252,7 @@ This function returns a cons cell @code{(@var{s} . @var{e})},
252where @var{s} and @var{e} are respectively the significand and 252where @var{s} and @var{e} are respectively the significand and
253exponent of the floating-point number @var{x}. 253exponent of the floating-point number @var{x}.
254 254
255If @var{x} is finite, @var{s} is a floating-point number between 0.5 255If @var{x} is finite, then @var{s} is a floating-point number between 0.5
256(inclusive) and 1.0 (exclusive), @var{e} is an integer, and 256(inclusive) and 1.0 (exclusive), @var{e} is an integer, and
257@ifnottex 257@ifnottex
258@var{x} = @var{s} * 2**@var{e}. 258@var{x} = @var{s} * 2**@var{e}.
@@ -260,9 +260,9 @@ If @var{x} is finite, @var{s} is a floating-point number between 0.5
260@tex 260@tex
261@math{x = s 2^e}. 261@math{x = s 2^e}.
262@end tex 262@end tex
263If @var{x} is zero or infinity, @var{s} is the same as @var{x}. 263If @var{x} is zero or infinity, then @var{s} is the same as @var{x}.
264If @var{x} is a NaN, @var{s} is also a NaN. 264If @var{x} is a NaN, then @var{s} is also a NaN.
265If @var{x} is zero, @var{e} is 0. 265If @var{x} is zero, then @var{e} is 0.
266@end defun 266@end defun
267 267
268@defun ldexp sig &optional exp 268@defun ldexp sig &optional exp
@@ -275,9 +275,9 @@ This function copies the sign of @var{x2} to the value of @var{x1},
275and returns the result. @var{x1} and @var{x2} must be floating point. 275and returns the result. @var{x1} and @var{x2} must be floating point.
276@end defun 276@end defun
277 277
278@defun logb number 278@defun logb x
279This function returns the binary exponent of @var{number}. More 279This function returns the binary exponent of @var{x}. More
280precisely, the value is the logarithm of |@var{number}| base 2, rounded 280precisely, the value is the logarithm base 2 of @math{|x|}, rounded
281down to an integer. 281down to an integer.
282 282
283@example 283@example
@@ -367,7 +367,7 @@ Here's a function to do this:
367@example 367@example
368(defvar fuzz-factor 1.0e-6) 368(defvar fuzz-factor 1.0e-6)
369(defun approx-equal (x y) 369(defun approx-equal (x y)
370 (or (and (= x 0) (= y 0)) 370 (or (= x y)
371 (< (/ (abs (- x y)) 371 (< (/ (abs (- x y))
372 (max (abs x) (abs y))) 372 (max (abs x) (abs y)))
373 fuzz-factor))) 373 fuzz-factor)))
@@ -648,10 +648,6 @@ number or a marker.
648 648
649If all the arguments are integers, the result is an integer, obtained 649If all the arguments are integers, the result is an integer, obtained
650by rounding the quotient towards zero after each division. 650by rounding the quotient towards zero after each division.
651(Hypothetically, some machines may have different rounding behavior
652for negative arguments, because @code{/} is implemented using the C
653division operator, which permits machine-dependent rounding; but this
654does not happen in practice.)
655 651
656@example 652@example
657@group 653@group
@@ -706,8 +702,7 @@ For any two integers @var{dividend} and @var{divisor},
706@end example 702@end example
707 703
708@noindent 704@noindent
709always equals @var{dividend}. If @var{divisor} is zero, Emacs signals 705always equals @var{dividend} if @var{divisor} is nonzero.
710an @code{arith-error} error.
711 706
712@example 707@example
713(% 9 4) 708(% 9 4)
@@ -769,7 +764,8 @@ For any two numbers @var{dividend} and @var{divisor},
769 764
770@noindent 765@noindent
771always equals @var{dividend}, subject to rounding error if either 766always equals @var{dividend}, subject to rounding error if either
772argument is floating point. For @code{floor}, see @ref{Numeric 767argument is floating point and to an @code{arith-error} if @var{dividend} is an
768integer and @var{divisor} is 0. For @code{floor}, see @ref{Numeric
773Conversions}. 769Conversions}.
774@end defun 770@end defun
775 771
@@ -1194,8 +1190,8 @@ non-integer, @code{expt} returns a NaN.
1194@end defun 1190@end defun
1195 1191
1196@defun sqrt arg 1192@defun sqrt arg
1197This returns the square root of @var{arg}. If @var{arg} is negative, 1193This returns the square root of @var{arg}. If @var{arg} is finite
1198@code{sqrt} returns a NaN. 1194and less than zero, @code{sqrt} returns a NaN.
1199@end defun 1195@end defun
1200 1196
1201In addition, Emacs defines the following common mathematical 1197In addition, Emacs defines the following common mathematical
@@ -1244,8 +1240,8 @@ any integer representable in Lisp, i.e., an integer between
1244@code{most-negative-fixnum} and @code{most-positive-fixnum} 1240@code{most-negative-fixnum} and @code{most-positive-fixnum}
1245(@pxref{Integer Basics}). 1241(@pxref{Integer Basics}).
1246 1242
1247If @var{limit} is @code{t}, it means to choose a new seed based on the 1243If @var{limit} is @code{t}, it means to choose a new seed as if Emacs
1248current time of day and on Emacs's process @acronym{ID} number. 1244were restarting.
1249 1245
1250If @var{limit} is a string, it means to choose a new seed based on the 1246If @var{limit} is a string, it means to choose a new seed based on the
1251string's contents. 1247string's contents.