GNU bug report logs - #20185
24.4.50; problem with built-in function "ldexp" Emacs Ver: 24.4.50.1

Previous Next

Package: emacs;

Reported by: Bernard Hurley <bernard <at> marcade.biz>

Date: Mon, 23 Mar 2015 20:30:03 UTC

Severity: minor

Found in version 24.4.50

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20185 in the body.
You can then email your comments to 20185 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#20185; Package emacs. (Mon, 23 Mar 2015 20:30:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Bernard Hurley <bernard <at> marcade.biz>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 23 Mar 2015 20:30:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Bernard Hurley <bernard <at> marcade.biz>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.4.50; problem with built-in function "ldexp" Emacs Ver: 24.4.50.1
Date: Mon, 23 Mar 2015 20:29:13 +0000
(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.




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Tue, 24 Mar 2015 18:58:01 GMT) Full text and rfc822 format available.

Notification sent to Bernard Hurley <bernard <at> marcade.biz>:
bug acknowledged by developer. (Tue, 24 Mar 2015 18:58:02 GMT) Full text and rfc822 format available.

Message #10 received at 20185-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Bernard Hurley <bernard <at> marcade.biz>
Cc: 20185-done <at> debbugs.gnu.org
Subject: Re: 24.4.50;
 problem with built-in function "ldexp" Emacs Ver: 24.4.50.1
Date: Tue, 24 Mar 2015 11:57:10 -0700
[Message part 1 (text/plain, inline)]
Thanks for catching that bug.  While fixing it I noticed some related 
minor glitches with ldexp, so I installed the attached patch.
[0001-Fix-minor-ldexp-issues.patch (text/x-patch, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 22 Apr 2015 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 56 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.