unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#25786: [PATCH] use of abs() in numbers.c: should be labs()
@ 2017-02-18 17:46 Matt Wette
  2017-02-21 21:13 ` Andy Wingo
  0 siblings, 1 reply; 2+ messages in thread
From: Matt Wette @ 2017-02-18 17:46 UTC (permalink / raw)
  To: 25786

[-- 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 --]

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

* bug#25786: [PATCH] use of abs() in numbers.c: should be labs()
  2017-02-18 17:46 bug#25786: [PATCH] use of abs() in numbers.c: should be labs() Matt Wette
@ 2017-02-21 21:13 ` Andy Wingo
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Wingo @ 2017-02-21 21:13 UTC (permalink / raw)
  To: Matt Wette; +Cc: 25786-done

On Sat 18 Feb 2017 18:46, Matt Wette <matt.wette@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





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

end of thread, other threads:[~2017-02-21 21:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-18 17:46 bug#25786: [PATCH] use of abs() in numbers.c: should be labs() Matt Wette
2017-02-21 21:13 ` Andy Wingo

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).