From 1a19cdcb82e2cfa7fa37bd96b8fd3231d63ad5a4 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Wed, 28 Jan 2009 16:37:31 +0000 Subject: [PATCH] 2009-01-28 17:41 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/common/hbprintf.c ! do not use _fpclass() in BCC builds - it breaks FL arithmetic * use _finitel() instead of _finite() in MSVC builds --- harbour/ChangeLog | 5 +++++ harbour/source/common/hbprintf.c | 14 ++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 696d978883..2b7e75b0ed 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,11 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-01-28 17:41 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/common/hbprintf.c + ! do not use _fpclass() in BCC builds - it breaks FL arithmetic + * use _finitel() instead of _finite() in MSVC builds + 2009-01-28 14:25 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/common/hbprintf.c ! include float.h in MSVC builds diff --git a/harbour/source/common/hbprintf.c b/harbour/source/common/hbprintf.c index f2a6978fea..956fed0ded 100644 --- a/harbour/source/common/hbprintf.c +++ b/harbour/source/common/hbprintf.c @@ -129,8 +129,11 @@ HB_EXTERN_END #define _HB_NUM_PINF 2 #define _HB_NUM_NINF 4 -#if defined( __BORLANDC__ ) - /* use Borland C _fpclass[l]() function */ +#if defined( __BORLANDC__ ) && 0 + /* do not use Borland C _fpclass[l]() function. + * it switches internal logic used for floating point calculation + * in this compiler reducing the precision to 'float' type. + */ # ifdef __NO_LONGDOUBLE__ # define hb_fpclassify( d ) _fpclass( d ) # else @@ -161,7 +164,7 @@ HB_EXTERN_END /* use C99 macros */ # define hb_signbit( d ) signbit( d ) -#elif defined( __BORLANDC__ ) +#elif defined( __BORLANDC__ ) && defined( hb_fpclassify ) # define hb_signbit( d ) ( ( hb_fpclassify( d ) & ( _FPCLASS_NINF | _FPCLASS_NZ ) ) != 0 ) @@ -204,7 +207,7 @@ HB_EXTERN_END } while( 0 ) # endif -#elif defined( __BORLANDC__ ) +#elif defined( __BORLANDC__ ) && defined( hb_fpclassify ) # define HB_NUMTYPE( v, d ) do { \ int t = hb_fpclassify( d ); \ @@ -219,6 +222,9 @@ HB_EXTERN_END defined(__XCC__) || defined(__POCC__) || \ defined(HB_OS_HPUX) # define hb_isfinite( d ) isfinite( d ) +# elif !defined( __NO_LONGDOUBLE__ ) && \ + ( defined( __BORLANDC__ ) || defined( _MSC_VER ) ) +# define hb_isfinite( d ) _finitel( d ) # elif defined( __BORLANDC__ ) || defined( __WATCOMC__ ) || defined( _MSC_VER ) # define hb_isfinite( d ) _finite( d ) # elif defined(__GNUC__) || defined(__DJGPP__) || defined(__MINGW32__) || \