emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lispref/numbers.texi


From: Richard M . Stallman
Subject: [Emacs-diffs] Changes to emacs/lispref/numbers.texi
Date: Mon, 14 Feb 2005 05:19:36 -0500

Index: emacs/lispref/numbers.texi
diff -c emacs/lispref/numbers.texi:1.33 emacs/lispref/numbers.texi:1.34
*** emacs/lispref/numbers.texi:1.33     Thu Nov 25 03:14:35 2004
--- emacs/lispref/numbers.texi  Mon Feb 14 10:19:36 2005
***************
*** 73,86 ****
  @cindex hex numbers
  @cindex octal numbers
  @cindex reading numbers in hex, octal, and binary
!   In addition, the Lisp reader recognizes a syntax for integers in
! bases other than 10: @address@hidden reads @var{integer} in
! binary (radix 2), @address@hidden reads @var{integer} in octal
! (radix 8), @address@hidden reads @var{integer} in hexadecimal
! (radix 16), and @address@hidden@var{integer}} reads @var{integer}
! in radix @var{radix} (where @var{radix} is between 2 and 36,
! inclusively).  Case is not significant for the letter after @samp{#}
! (@samp{B}, @samp{O}, etc.) that denotes the radix.
  
    To understand how various functions work on integers, especially the
  bitwise operators (@pxref{Bitwise Operations}), it is often helpful to
--- 73,93 ----
  @cindex hex numbers
  @cindex octal numbers
  @cindex reading numbers in hex, octal, and binary
!   The syntax for integers in bases other than 10 uses @samp{#}
! followed by a letter that specifies the radix: @samp{b} for binary,
! @samp{o} for octal, @samp{x} for hex, or @address@hidden to
! specify radix @var{radix}.  Case is not significant for the letter
! that specifies the radix.  Thus, @address@hidden reads
! @var{integer} in binary, and @address@hidden@var{integer}} reads
! @var{integer} in radix @var{radix}.  Allowed values of @var{radix} run
! from 2 to 36.  For example:
! 
! @example
! #b101100 @result{} 44
! #o54 @result{} 44
! #x2c @result{} 44
! #24r1k @result{} 44
! @end example
  
    To understand how various functions work on integers, especially the
  bitwise operators (@pxref{Bitwise Operations}), it is often helpful to
***************
*** 211,223 ****
  @node Predicates on Numbers
  @section Type Predicates for Numbers
  
!   The functions in this section test whether the argument is a number or
! whether it is a certain sort of number.  The functions @code{integerp}
! and @code{floatp} can take any type of Lisp object as argument (the
! predicates would not be of much use otherwise); but the @code{zerop}
! predicate requires a number as its argument.  See also
! @code{integer-or-marker-p} and @code{number-or-marker-p}, in
! @ref{Predicates on Markers}.
  
  @defun floatp object
  This predicate tests whether its argument is a floating point
--- 218,229 ----
  @node Predicates on Numbers
  @section Type Predicates for Numbers
  
!   The functions in this section test for numbers, or for a specific
! type of number.  The functions @code{integerp} and @code{floatp} can
! take any type of Lisp object as argument (they would not be of much
! use otherwise), but the @code{zerop} predicate requires a number as
! its argument.  See also @code{integer-or-marker-p} and
! @code{number-or-marker-p}, in @ref{Predicates on Markers}.
  
  @defun floatp object
  This predicate tests whether its argument is a floating point
***************
*** 251,257 ****
  This predicate tests whether its argument is zero, and returns @code{t}
  if so, @code{nil} otherwise.  The argument must be a number.
  
! These two forms are equivalent: @code{(zerop x)} @equiv{} @code{(= x 0)}.
  @end defun
  
  @node Comparison of Numbers
--- 257,263 ----
  This predicate tests whether its argument is zero, and returns @code{t}
  if so, @code{nil} otherwise.  The argument must be a number.
  
! @code{(zerop x)} is equivalent to @code{(= x 0)}.
  @end defun
  
  @node Comparison of Numbers
***************
*** 275,284 ****
  can, even for comparing integers, just in case we change the
  representation of integers in a future Emacs version.
  
!   Sometimes it is useful to compare numbers with @code{equal}; it treats
! two numbers as equal if they have the same data type (both integers, or
! both floating point) and the same value.  By contrast, @code{=} can
! treat an integer and a floating point number as equal.
  
    There is another wrinkle: because floating point arithmetic is not
  exact, it is often a bad idea to check for equality of two floating
--- 281,291 ----
  can, even for comparing integers, just in case we change the
  representation of integers in a future Emacs version.
  
!   Sometimes it is useful to compare numbers with @code{equal}; it
! treats two numbers as equal if they have the same data type (both
! integers, or both floating point) and the same value.  By contrast,
! @code{=} can treat an integer and a floating point number as equal.
! @xref{Equality Predicates}.
  
    There is another wrinkle: because floating point arithmetic is not
  exact, it is often a bad idea to check for equality of two floating
***************
*** 309,318 ****
  @end defun
  
  @defun eql value1 value2
! This function compares two floating point numbers like @code{=}, and
! compares two integers like @code{=}, and acts like @code{eq} in all
! other cases.  Thus, @code{(eql 1.0 1)} returns @code{nil}, but
! @code{(eql 1.0 1.0)} and @code{(eql 1 1)} both return @code{t}.
  @end defun
  
  @defun /= number-or-marker1 number-or-marker2
--- 316,325 ----
  @end defun
  
  @defun eql value1 value2
! This function acts like @code{eq} except when both arguments are
! numbers.  It compares numbers by type and numberic value, so that
! @code{(eql 1.0 1)} returns @code{nil}, but @code{(eql 1.0 1.0)} and
! @code{(eql 1 1)} both return @code{t}.
  @end defun
  
  @defun /= number-or-marker1 number-or-marker2
***************
*** 345,351 ****
  
  @defun max number-or-marker &rest numbers-or-markers
  This function returns the largest of its arguments.
! If any of the argument is floating-point, the value is returned
  as floating point, even if it was given as an integer.
  
  @example
--- 352,358 ----
  
  @defun max number-or-marker &rest numbers-or-markers
  This function returns the largest of its arguments.
! If any of the arguments is floating-point, the value is returned
  as floating point, even if it was given as an integer.
  
  @example
***************
*** 360,366 ****
  
  @defun min number-or-marker &rest numbers-or-markers
  This function returns the smallest of its arguments.
! If any of the argument is floating-point, the value is returned
  as floating point, even if it was given as an integer.
  
  @example
--- 367,373 ----
  
  @defun min number-or-marker &rest numbers-or-markers
  This function returns the smallest of its arguments.
! If any of the arguments is floating-point, the value is returned
  as floating point, even if it was given as an integer.
  
  @example
***************
*** 1147,1154 ****
  @defun expt x y
  This function returns @var{x} raised to power @var{y}.  If both
  arguments are integers and @var{y} is positive, the result is an
! integer; in this case, it is truncated to fit the range of possible
! integer values.
  @end defun
  
  @defun sqrt arg
--- 1154,1160 ----
  @defun expt x y
  This function returns @var{x} raised to power @var{y}.  If both
  arguments are integers and @var{y} is positive, the result is an
! integer; in this case, overflow causes truncation, so watch out.
  @end defun
  
  @defun sqrt arg




reply via email to

[Prev in Thread] Current Thread [Next in Thread]