diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2019-01-06 16:23:41 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2019-01-06 16:25:40 -0800 |
commit | 202bd7bff2710b98cde4ae4b6e1f6de9818591f8 (patch) | |
tree | 5b58e9df997c158ccd6887a1c5ac81533040744f /doc | |
parent | b0b483d714e87ee0a4572f9c541514a1ac1a8226 (diff) | |
download | emacs-202bd7bff2710b98cde4ae4b6e1f6de9818591f8.tar.gz |
Fix logb on zero, infinite, NaN args
Change logb to return -infinity, +infinity, and NaN respectively.
Formerly logb returned an extreme fixnum to represent
infinity, but this is no longer the right thing to do now that
we have bignums and there is no extreme integer.
* doc/lispref/numbers.texi (Float Basics), etc/NEWS: Document.
* src/floatfns.c (Flogb): Implement this.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/lispref/numbers.texi | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi index cffc634169f..fbdd83fa86e 100644 --- a/doc/lispref/numbers.texi +++ b/doc/lispref/numbers.texi @@ -313,14 +313,18 @@ and returns the result. @var{x1} and @var{x2} must be floating point. @defun logb x This function returns the binary exponent of @var{x}. More -precisely, the value is the logarithm base 2 of @math{|x|}, rounded -down to an integer. +precisely, if @var{x} is finite and nonzero, the value is the +logarithm base 2 of @math{|x|}, rounded down to an integer. +If @var{x} is zero, infinite, or a NaN, the value is minus infinity, +plus infinity, or a NaN respectively. @example (logb 10) @result{} 3 (logb 10.0e20) @result{} 69 +(logb 0) + @result{} -1.0e+INF @end example @end defun |