chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] Fix solaris9 build for missing trunc, round, isinf


From: Felix
Subject: Re: [Chicken-hackers] Fix solaris9 build for missing trunc, round, isinf math functions
Date: Sat, 20 Apr 2013 23:51:45 +0200 (CEST)

From: Michele La Monaca <address@hidden>
Subject: Re: [Chicken-hackers] Fix solaris9 build for missing trunc, round, 
isinf math functions
Date: Sat, 20 Apr 2013 17:18:07 +0200

> I've spotted an error in the patch.
> 
> static inline double trunc(double x) { return (x > 0 ? floor(x) :
> floor(x) + 1); }
> 
> should be:
> 
> static inline double trunc(double x) { return (x >= 0 ? floor(x) :
> floor(x) + 1); }
> 
> please correct it before pushing.

Attached is the patch with the applied fix. I pushed from the wrong
branch, therefore it didn't show up in master (I'm still too thick to
use git correctly...).

Contrary to most others on this list I think it is generally a good
idea to support different compilers, if the necessary changes are not
too involved (as compared to, say, MSVC). 


cheers,
felix
>From 3ea4c865da7b07f548cdd9208bc596bca7e99e9a Mon Sep 17 00:00:00 2001
From: Michele La Monaca <address@hidden>
Date: Wed, 17 Apr 2013 23:21:14 +0200
Subject: [PATCH] fixed solaris9 build for missing trunc,round,isinf

With fix added as reported by Michele La Monaca (who also provided the original 
patch).

Signed-off-by: felix <address@hidden>
---
 chicken.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/chicken.h b/chicken.h
index 2b9030a..0e6b735 100644
--- a/chicken.h
+++ b/chicken.h
@@ -89,7 +89,7 @@
 # define C_NONUNIX
 #endif
 
-#if defined(__sun__) && defined(__svr4__)
+#if defined(__sun__) && defined(__svr4__) || defined(__SUNPRO_C)
 # define C_SOLARIS
 #endif
 
@@ -976,6 +976,9 @@ DECL_C_PROC_p0 (128,  1,0,0,0,0,0,0,0)
 # ifdef __linux__
 extern double round(double);
 extern double trunc(double);
+# elif defined (__SunOS_5_9)
+static inline double trunc(double x) { return (x >= 0 ? floor(x) : floor(x) + 
1); }
+static inline double round(double x) { return (x - floor(x) >= 0.5 ? floor(x) 
+ 1 : floor(x)); }
 # endif
 #else
 /* provide this file and define C_PROVIDE_LIBC_STUBS if you want to use
-- 
1.7.9.5


reply via email to

[Prev in Thread] Current Thread [Next in Thread]