2008-11-26 18:22 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/vm/itemapi.c
    * changed hb_itemPutNLen() function to create integer item only
      when conversion to HB_LONG does not change value of passed double
      argument. It fixes some problems like restoring non integer double
      values with 0 decimal places by __MVRESTORE()

  * harbour/source/rtl/val.c
    % minor optimization
This commit is contained in:
Przemyslaw Czerpak
2008-11-26 17:21:08 +00:00
parent 9279f182f6
commit 7ad0d5f23f
3 changed files with 26 additions and 10 deletions

View File

@@ -8,6 +8,16 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2008-11-26 18:22 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/vm/itemapi.c
* changed hb_itemPutNLen() function to create integer item only
when conversion to HB_LONG does not change value of passed double
argument. It fixes some problems like restoring non integer double
values with 0 decimal places by __MVRESTORE()
* harbour/source/rtl/val.c
% minor optimization
2008-11-25 09:15 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* harbour/contrib/gtwvg/wvggui.c
* harbour/contrib/gtwvg/wvgdlg.prg

View File

@@ -72,7 +72,7 @@ HB_FUNC( VAL )
if( !fDbl )
hb_retnintlen( lValue, iWidth );
else
hb_retnlen( dValue, iWidth, iDec );
hb_retndlen( dValue, iWidth, iDec );
}
else
hb_errRT_BASE_SubstR( EG_ARG, 1098, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );

View File

@@ -956,18 +956,24 @@ PHB_ITEM hb_itemPutNLen( PHB_ITEM pItem, double dNumber, int iWidth, int iDec )
if( iDec < 0 )
iDec = hb_stackSetStruct()->HB_SET_DECIMALS;
if( iDec > 0 )
return hb_itemPutNDLen( pItem, dNumber, iWidth, iDec );
else if( HB_DBL_LIM_INT( dNumber ) )
return hb_itemPutNILen( pItem, ( int ) dNumber, iWidth );
else if( HB_DBL_LIM_LONG( dNumber ) )
if( iDec == 0 )
{
HB_LONG lNumber = ( HB_LONG ) dNumber;
if( ( double ) lNumber == dNumber )
{
if( HB_LIM_INT( lNumber ) )
return hb_itemPutNILen( pItem, ( int ) lNumber, iWidth );
else
#ifdef HB_LONG_LONG_OFF
return hb_itemPutNLLen( pItem, ( long ) dNumber, iWidth );
return hb_itemPutNLLen( pItem, ( long ) lNumber, iWidth );
#else
return hb_itemPutNLLLen( pItem, ( LONGLONG ) dNumber, iWidth );
return hb_itemPutNLLLen( pItem, ( LONGLONG ) lNumber, iWidth );
#endif
else
return hb_itemPutNDLen( pItem, dNumber, iWidth, 0 );
}
}
return hb_itemPutNDLen( pItem, dNumber, iWidth, iDec );
}
PHB_ITEM hb_itemPutNDLen( PHB_ITEM pItem, double dNumber, int iWidth, int iDec )