unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH] Fix compiler warning about `abs'
@ 2014-09-04 18:15 Zach Davis
  0 siblings, 0 replies; only message in thread
From: Zach Davis @ 2014-09-04 18:15 UTC (permalink / raw)
  To: guile-devel

Hello all-

I recently compiled master with clang, and it pointed out a warning
about abs/labs.

I wasn't able to force a bug from the warning, but it was an easy enough fix.

Zach

From d723f275ffe67d75e2d015d0b0c629c921579200 Mon Sep 17 00:00:00 2001
From: Zach Davis <address@hidden>
Date: Thu, 4 Sep 2014 12:57:17 -0500
Subject: [PATCH] Fix compiler warning about `abs'

Clang noted that `labs' should be used instead of `abs' for longs.

* libguile/numbers.c (log_of_fraction): Use labs instead of abs.
---
 libguile/numbers.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libguile/numbers.c b/libguile/numbers.c
index 14d98ff..14b11c8 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -9982,7 +9982,7 @@ 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)
+  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)))
-- 
1.7.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-09-04 18:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-04 18:15 [PATCH] Fix compiler warning about `abs' Zach Davis

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