mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-02 08:22:22 +00:00
Fix minor ldexp issues
* doc/lispref/numbers.texi (Float Basics): Improve ldexp documentation. * src/floatfns.c (Fldexp): Require 2 args. Avoid undefined behavior if the exponent is out of 'int' range. Improve documentation. Fixes: bug#20185
This commit is contained in:
parent
1e043f5e79
commit
711770da91
@ -1,3 +1,7 @@
|
||||
2015-03-24 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* numbers.texi (Float Basics): Improve ldexp documentation.
|
||||
|
||||
2015-03-23 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* commands.texi (Event Input Misc): Fix incorrect usage of @code.
|
||||
|
@ -265,9 +265,15 @@ If @var{x} is a NaN, then @var{s} is also a NaN@.
|
||||
If @var{x} is zero, then @var{e} is 0.
|
||||
@end defun
|
||||
|
||||
@defun ldexp sig &optional exp
|
||||
This function returns a floating-point number corresponding to the
|
||||
significand @var{sig} and exponent @var{exp}.
|
||||
@defun ldexp s e
|
||||
Given a numeric significand @var{s} and an integer exponent @var{e},
|
||||
this function returns the floating point number
|
||||
@ifnottex
|
||||
@var{s} * 2**@var{e}.
|
||||
@end ifnottex
|
||||
@tex
|
||||
@math{s 2^e}.
|
||||
@end tex
|
||||
@end defun
|
||||
|
||||
@defun copysign x1 x2
|
||||
|
@ -1,3 +1,10 @@
|
||||
2015-03-24 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Fix minor ldexp issues
|
||||
* floatfns.c (Fldexp): Require 2 args. Avoid undefined behavior
|
||||
if the exponent is out of 'int' range. Improve documentation.
|
||||
Fixes: bug#20185
|
||||
|
||||
2015-03-24 Daniel Colascione <dancol@dancol.org>
|
||||
|
||||
* process.c (Fprocess_running_child_p): Return number identifier of
|
||||
|
@ -185,14 +185,14 @@ If X is zero, both parts (SGNFCAND and EXP) are zero. */)
|
||||
return Fcons (make_float (sgnfcand), make_number (exponent));
|
||||
}
|
||||
|
||||
DEFUN ("ldexp", Fldexp, Sldexp, 1, 2, 0,
|
||||
doc: /* Construct number X from significand SGNFCAND and exponent EXP.
|
||||
Returns the floating point value resulting from multiplying SGNFCAND
|
||||
(the significand) by 2 raised to the power of EXP (the exponent). */)
|
||||
DEFUN ("ldexp", Fldexp, Sldexp, 2, 2, 0,
|
||||
doc: /* Return X * 2**EXP, as a floating point number.
|
||||
EXP must be an integer. */)
|
||||
(Lisp_Object sgnfcand, Lisp_Object exponent)
|
||||
{
|
||||
CHECK_NUMBER (exponent);
|
||||
return make_float (ldexp (XFLOATINT (sgnfcand), XINT (exponent)));
|
||||
int e = min (max (INT_MIN, XINT (exponent)), INT_MAX);
|
||||
return make_float (ldexp (XFLOATINT (sgnfcand), e));
|
||||
}
|
||||
|
||||
DEFUN ("exp", Fexp, Sexp, 1, 1, 0,
|
||||
|
Loading…
Reference in New Issue
Block a user