* Christian Kellermann <ck...@pestilenz.org> [120316 09:53]:
> * felix winkelmann <fe...@call-with-current-continuation.org> [120316 08:33]:
> > >> > - [PATCH] Bugfix for #791 and unpack flonums correctly for integer?
> > >> 
> > >> Can't remember.
> > > 
> > > http://lists.nongnu.org/archive/html/chicken-hackers/2012-03/msg00010.html
> > > 
> > 
> > Signed off and pushed.
> 
> This patch breaks the tests for me. This is due to library tests
> being compiled with specialisation.
> 
> The test in question is:
> 
> (assert (not (integer? +inf.)))
> 
> 
> This works fine in csi:
> 
> #;1> (not (integer? +inf.))
> #t
> 
> Also the assert works fine.
> 
> Did make check pass for you with the compiled library tests? I am
> testing on a 64 bit linux.

I have attached a patch to fix the specialisation for the C_u_i_fpintegerp.

BUT while this patch looks ok, it segfaults for me when doing the library tests.
Could it be that the type guessing here is wrong in a particular case?

The patch looks fine and is meant to compile ;)

Cheers,

Christian

-- 
9 out of 10 voices in my head say, that I am crazy,
one is humming.
>From b0445c6e497c175c2dee96948630a10b7a4c4aac Mon Sep 17 00:00:00 2001
From: Christian Kellermann <ck...@pestilenz.org>
Date: Fri, 16 Mar 2012 11:35:57 +0100
Subject: [PATCH] Check for isnan & isinf in C_u_i_fpintegerp

---
 chicken.h |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/chicken.h b/chicken.h
index 9237e14..cd73152 100644
--- a/chicken.h
+++ b/chicken.h
@@ -2182,9 +2182,13 @@ C_inline C_word C_i_rationalp(C_word x)
 
 C_inline C_word C_u_i_fpintegerp(C_word x)
 {
-  double dummy;
+  double dummy, val;
+
+  val = C_flonum_magnitude(x);
 
-  return C_mk_bool(C_modf(C_flonum_magnitude(x), &dummy) == 0.0);
+  if(C_isnan(val) || C_isinf(val)) return C_SCHEME_FALSE;
+
+  return C_mk_bool(C_modf(val, &dummy) == 0.0);
 }
 
 
-- 
1.7.4.1

_______________________________________________
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to