/* converts a numeric to a string with optional width & precision.
This function should be used by any function that wants to format numeric
data for displaying, printing, or putting in a database.
Note: The caller is responsible for calling hb_xfree to free the results
buffer, but ONLY if the return value is not a NULL pointer! (If a NULL
pointer is returned, then there was a conversion error.)
*/
char * hb_itemStr( PHB_ITEM pNumber, PHB_ITEM pWidth, PHB_ITEM pDec )
Bug en los operadores fwh2409 xharbour 64 bits (solucionado)
- Antonio Linares
- Site Admin
- Posts: 42393
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 9 times
- Been thanked: 41 times
- Contact:
Re: Bug en los operadores fwh2409 xharbour 64 bits
- Antonio Linares
- Site Admin
- Posts: 42393
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 9 times
- Been thanked: 41 times
- Contact:
Re: Bug en los operadores fwh2409 xharbour 64 bits
Getting closer:
.../* converts a numeric to a padded string iSize length and iDec number
of digits after dot.
Note: szResult has to be at least iSize + 1 length.
*/
BOOL hb_itemStrBuf( char * szResult, PHB_ITEM pNumber, int iSize, int iDec )
/* Set to asterisks in case of overflow */
if( iPos < 0 )
{
memset( szResult, '*', iSize );
return FALSE;
}
- Antonio Linares
- Site Admin
- Posts: 42393
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 9 times
- Been thanked: 41 times
- Contact:
Re: Bug en los operadores fwh2409 xharbour 64 bits
We have to compare Harbour and xHarbour source code on:
BOOL hb_itemStrBuf( char * szResult, PHB_ITEM pNumber, int iSize, int iDec )
as xHarbour reports the number is NOT finite and thus the "*":
BOOL hb_itemStrBuf( char * szResult, PHB_ITEM pNumber, int iSize, int iDec )
as xHarbour reports the number is NOT finite and thus the "*":
Code: Select all | Expand
function Main()
Test( 2032212 / 30 * 30, 50, 2 )
return nil
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
#include <hbapiitm.h>
#include <stdio.h>
#define HB_FINITE_DBL( d ) ( _finite( d ) != 0 )
HB_FUNC( TEST )
{
PHB_ITEM pNumber = hb_param( 1, HB_IT_DOUBLE );
char buffer[ 100 ];
OutputDebugString( hb_itemStr( hb_param( 1, HB_IT_DOUBLE ),
hb_param( 2, HB_IT_NUMERIC ), hb_param( 3, HB_IT_NUMERIC ) ) );
sprintf (buffer, "%i", (int) pNumber->item.asDouble.length );
OutputDebugString( buffer );
if( HB_FINITE_DBL( hb_parnd( 1 ) ) )
OutputDebugString( "Finite" );
else
OutputDebugString( "Not finite" );
}
#pragma ENDDUMP
- Antonio Linares
- Site Admin
- Posts: 42393
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 9 times
- Been thanked: 41 times
- Contact:
Re: Bug en los operadores fwh2409 xharbour 64 bits
Bug solucionado ?
Dear Enrico,
Could you please modify this on xHarbour source code ?
xharbour/source/vm/itemapi.c
on line 1426:
#if defined( __RSXNT__ ) || defined( __EMX__ ) || \
defined( __XCC__ ) || defined( __POCC__ ) || defined( __DMC__ ) || \
defined( HB_OS_HPUX )
# define HB_FINITE_DBL( d ) ( isfinite( d ) != 0 )
#elif defined( __clang__ )
# define HB_FINITE_DBL( d ) ( isfinite( d ) != 0 )
#elif defined( __WATCOMC__ ) || defined( __BORLANDC__ ) || defined( _MSC_VER )
# define HB_FINITE_DBL( d ) ( _finite( d ) != 0 )
#elif defined(__APPLE__)
# define HB_FINITE_DBL( d ) ( isfinite( d ) != 0 )
#elif defined( __GNUC__ ) || defined( __DJGPP__ ) || defined( __MINGW32__ ) || \
defined( __LCC__ )
# define HB_FINITE_DBL( d ) ( finite( d ) != 0 )
Please build xHarbour 64 with this change and lets test your example
Dear Enrico,
Could you please modify this on xHarbour source code ?
xharbour/source/vm/itemapi.c
on line 1426:
#if defined( __RSXNT__ ) || defined( __EMX__ ) || \
defined( __XCC__ ) || defined( __POCC__ ) || defined( __DMC__ ) || \
defined( HB_OS_HPUX )
# define HB_FINITE_DBL( d ) ( isfinite( d ) != 0 )
#elif defined( __clang__ )
# define HB_FINITE_DBL( d ) ( isfinite( d ) != 0 )
#elif defined( __WATCOMC__ ) || defined( __BORLANDC__ ) || defined( _MSC_VER )
# define HB_FINITE_DBL( d ) ( _finite( d ) != 0 )
#elif defined(__APPLE__)
# define HB_FINITE_DBL( d ) ( isfinite( d ) != 0 )
#elif defined( __GNUC__ ) || defined( __DJGPP__ ) || defined( __MINGW32__ ) || \
defined( __LCC__ )
# define HB_FINITE_DBL( d ) ( finite( d ) != 0 )
Please build xHarbour 64 with this change and lets test your example
- Enrico Maria Giordano
- Posts: 8734
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Been thanked: 1 time
- Contact:
- leandro
- Posts: 1719
- Joined: Wed Oct 26, 2005 2:49 pm
- Location: Colombia
- Has thanked: 11 times
- Been thanked: 3 times
- Contact:
Re: Bug en los operadores fwh2409 xharbour 64 bits
Antonio y Enrico, como siempre muchas gracias por la ayuda, definitivamente son unos genios, no se que haríamos sin ustedes?
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com
[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 24.09 ] [ xHarbour 64 bits) ]
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com
[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 24.09 ] [ xHarbour 64 bits) ]