On Fri, Jul 31, 2009 at 8:02 AM, Alejandro Forero
Cuervo<a...@freaks-unidos.net> wrote:
> In Chicken 3.4.0 linux-unix-gnu-x86-64 the expression (abs 2147483648)
> evaluates to -2147483648 in both csi and a compiled program (negative?
> and positive?, however, seem to work correctly).  It evaluated
> correctly in a 32-bits build of the same version.

Please try attached patch.
Jim
Index: runtime.c
===================================================================
--- runtime.c   (revision 15090)
+++ runtime.c   (working copy)
@@ -5382,7 +5382,7 @@
 
 C_regparm C_word C_fcall C_a_i_abs(C_word **a, int c, C_word x)
 {
-  if(x & C_FIXNUM_BIT) return C_fix(abs(C_unfix(x)));
+  if(x & C_FIXNUM_BIT) return C_fix(labs(C_unfix(x)));
 
   if(C_immediatep(x) || C_block_header(x) != C_FLONUM_TAG)
     barf(C_BAD_ARGUMENT_TYPE_ERROR, "abs", x);
_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to