unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20185: 24.4.50; problem with built-in function "ldexp" Emacs Ver: 24.4.50.1
@ 2015-03-23 20:29 Bernard Hurley
  2015-03-24 18:57 ` Paul Eggert
  0 siblings, 1 reply; 2+ messages in thread
From: Bernard Hurley @ 2015-03-23 20:29 UTC (permalink / raw)
  To: 20185


(24.4.50) 3.2 Floating-Point Basics we read:

---------- snip ------------
 -- Function: ldexp sig &optional exp
     This function returns a floating-point number corresponding to the
     significand SIG and exponent EXP.
----------snip -------------

However it is easy to verify that the second argument is not
optional. For example:

    (ldexp 5.0)

triggers the error:

    *** Eval error ***  Wrong type argument: integerp, nil

The code for ldexp in floatfn.c reads:

---------- snip ---------------
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).   */)
  (Lisp_Object sgnfcand, Lisp_Object exponent)
{
  CHECK_NUMBER (exponent);
  return make_float (ldexp (XFLOATINT (sgnfcand), XINT (exponent)));
}
---------- snip -------------

The declaration conforms to that in the manual but nothing seems to have
been done to take into account what happens when `exp' is missing.  It
seems to me that there are two possibilities:

EITHER: The declaration in floatfns.c is incorrect and should read:

    DEFUN ("ldexp", Fldexp, Sldexp, 1, 1, 0,
    ....

In which case it will need to be changed and the manual will need to be
changed accordingly.


OR: `exp' is supposed to have a default value (0 say), when the code in
floatfns.c should be changed accordingly.  In this case it might still
be a good idea to update the manual to explain that it has this value.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-24 18:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-23 20:29 bug#20185: 24.4.50; problem with built-in function "ldexp" Emacs Ver: 24.4.50.1 Bernard Hurley
2015-03-24 18:57 ` Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).