From: Matt Wette <matt.wette@gmail.com>
To: 25786@debbugs.gnu.org
Subject: bug#25786: [PATCH] use of abs() in numbers.c: should be labs()
Date: Sat, 18 Feb 2017 09:46:07 -0800 [thread overview]
Message-ID: <90F3BCE0-765F-43F6-B3ED-7B339EF9B2F0@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 979 bytes --]
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)))
[-- Attachment #2: Type: text/html, Size: 5071 bytes --]
next reply other threads:[~2017-02-18 17:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-18 17:46 Matt Wette [this message]
2017-02-21 21:13 ` bug#25786: [PATCH] use of abs() in numbers.c: should be labs() Andy Wingo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=90F3BCE0-765F-43F6-B3ED-7B339EF9B2F0@gmail.com \
--to=matt.wette@gmail.com \
--cc=25786@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).