[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-windows
Subject:    long double pow(int,int) vs double pow(int,int) in msvc 2005 / 2003
From:       Jarosław_Staniek <js () iidea ! pl>
Date:       2007-06-20 19:07:34
Message-ID: 46797AF6.4090400 () iidea ! pl
[Download RAW message or body]

Christian and others,
1. Could you compare math.h from msvc 2005 and 2003? I've got the following 
error in kdelibs:

kimageeffect.cpp
F:\kde4\include\msvc\math.h(464) : error C2556: 'long double pow(int,int)' :
overloaded function differs only by return type from 'double pow(int,int)'
          c:\vs7\Vc7\include\../include\math.h(534) : see declaration of 'pow'
F:\kde4\include\msvc\math.h(464) : error C2371: 'pow' : redefinition;
different basic types

2. The attached patch adds missing functions like floorf() (not all included)
on msvc 7.

I am looking for a way to avoid #ifdefs in user's code and to have things
working with 2003 and 2005+.

Is long double pow(int,int) or double pow(int,int) needed at all? this is not
in POSIX... IIRC. Maybe remove it from msvc/math.h ?

-- 
regards / pozdrawiam, Jaroslaw Staniek
   Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
   Kexi & KOffice: http://www.kexi.pl/en, http://www.koffice.org
   KDE3 & KDE4 Libraries for MS Windows: http://kdelibs.com, http://www.kde.org


["floorf.patch" (text/plain)]

Index: include/msvc/math.h
===================================================================
--- include/msvc/math.h	(revision 678117)
+++ include/msvc/math.h	(working copy)
@@ -139,6 +139,14 @@
 WINPOSIX_EXPORT float tgammaf (float);
 #define tgammal tgamma
 
+#if !defined __cplusplus && defined _MSC_VER && _MSC_VER <= 1310
+KDEWIN32_EXPORT float floorf(float x);
+KDEWIN32_EXPORT float sinf(float x);
+KDEWIN32_EXPORT float logf(float x);
+KDEWIN32_EXPORT float powf(float x, float y);
+KDEWIN32_EXPORT float expf(float x);
+#endif
+
 /* 7.12.9.3 */
 // this is a little bit more complicated - don't raise an exception
 // -> set fpu control word bit 5 so it won't generate one
Index: src/math/math.c
===================================================================
--- src/math/math.c	(revision 678117)
+++ src/math/math.c	(working copy)
@@ -39,3 +39,14 @@
 KDEWIN32_EXPORT union _ieee_rep __SNANL  = { __DOUBLE_SNAN_REP };
 KDEWIN32_EXPORT union _ieee_rep __INFL = { __DOUBLE_INF_REP };
 KDEWIN32_EXPORT union _ieee_rep __DENORML = { __DOUBLE_DENORM_REP };
+
+#if !defined __cplusplus && defined _MSC_VER && _MSC_VER <= 1310
+#include <../include/math.h>
+
+KDEWIN32_EXPORT float floorf(float x) { return ((float)floor((double)x)); }
+KDEWIN32_EXPORT float sinf(float x) {return ((float)sin((double)x)); }
+KDEWIN32_EXPORT float logf(float x) {return ((float)log((double)x)); }
+KDEWIN32_EXPORT float powf(float x, float y) {return ((float)pow((double)x, (double)y)); }
+KDEWIN32_EXPORT float expf(float x) {return ((float)exp((double)x)); }
+
+#endif



_______________________________________________
Kde-windows mailing list
Kde-windows@kde.org
https://mail.kde.org/mailman/listinfo/kde-windows


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic