diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 96b21d8c5a..3e90397f00 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,12 @@ 2002-12-01 23:12 UTC+0100 Foo Bar */ +2004-01-13 09:35 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * xharbour/source/rtl/mod.c + ! fixed mod() function to be Clipper/DBASE III compatible + (not the % operator) for combination of psitive and negative + numbers + 2004-01-13 08:15 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + harbour/include/hbfixdj.h diff --git a/harbour/source/rtl/mod.c b/harbour/source/rtl/mod.c index 188288584c..53d2d925f7 100644 --- a/harbour/source/rtl/mod.c +++ b/harbour/source/rtl/mod.c @@ -76,7 +76,11 @@ HB_FUNC( MOD ) if( dBase ) { - hb_retnd( fmod( dNumber, dBase ) ); + double dResult = fmod( dNumber, dBase ); + + if ( dResult && ( dNumber > 0 ? dBase < 0 : dBase > 0 ) ) + dResult += dBase; + hb_retnd( dResult ); } else {