GNU bug report logs - #25786
[PATCH] use of abs() in numbers.c: should be labs()

Previous Next

Package: guile;

Reported by: Matt Wette <matt.wette <at> gmail.com>

Date: Sat, 18 Feb 2017 17:47:02 UTC

Severity: normal

Tags: patch

Done: Andy Wingo <wingo <at> pobox.com>

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 25786 in the body.
You can then email your comments to 25786 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-guile <at> gnu.org:
bug#25786; Package guile. (Sat, 18 Feb 2017 17:47:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Matt Wette <matt.wette <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Sat, 18 Feb 2017 17:47:02 GMT) Full text and rfc822 format available.

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

From: Matt Wette <matt.wette <at> gmail.com>
To: bug-guile <at> gnu.org
Subject: [PATCH] use of abs() in numbers.c: should be labs()
Date: Sat, 18 Feb 2017 09:46:07 -0800
[Message part 1 (text/plain, inline)]
In libguile/numbers.c abs() is used for long argument where labs() should be used.  
A patch is included below for guile-2.1.7.

/* Returns log(n/d), for exact non-zero integers n and d */
static SCM
log_of_fraction (SCM n, SCM d)
{
  long n_size = scm_to_long (scm_integer_length (n));
  long d_size = scm_to_long (scm_integer_length (d));

  if (abs (n_size - d_size) > 1)
    return (scm_difference (log_of_exact_integer (n),
                            log_of_exact_integer (d)));


--- libguile/numbers.c.orig	2017-02-18 08:29:52.000000000 -0800
+++ libguile/numbers.c	2017-02-18 08:30:23.000000000 -0800
@@ -9951,7 +9951,7 @@
   long n_size = scm_to_long (scm_integer_length (n));
   long d_size = scm_to_long (scm_integer_length (d));
 
-  if (abs (n_size - d_size) > 1)
+  if (labs (n_size - d_size) > 1)
     return (scm_difference (log_of_exact_integer (n),
 			    log_of_exact_integer (d)));
   else if (scm_is_false (scm_negative_p (n)))

[Message part 2 (text/html, inline)]

Reply sent to Andy Wingo <wingo <at> pobox.com>:
You have taken responsibility. (Tue, 21 Feb 2017 21:14:02 GMT) Full text and rfc822 format available.

Notification sent to Matt Wette <matt.wette <at> gmail.com>:
bug acknowledged by developer. (Tue, 21 Feb 2017 21:14:02 GMT) Full text and rfc822 format available.

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

From: Andy Wingo <wingo <at> pobox.com>
To: Matt Wette <matt.wette <at> gmail.com>
Cc: 25786-done <at> debbugs.gnu.org
Subject: Re: bug#25786: [PATCH] use of abs() in numbers.c: should be labs()
Date: Tue, 21 Feb 2017 22:13:11 +0100
On Sat 18 Feb 2017 18:46, Matt Wette <matt.wette <at> gmail.com> writes:

> In libguile/numbers.c abs() is used for long argument where labs() should be used. 
> A patch is included below for guile-2.1.7.

Applied.  Thank you!

Andy




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

This bug report was last modified 8 years and 89 days ago.

Previous Next


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