FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Problem with numeric fields and FWH 25.01
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Problem with numeric fields and FWH 25.01
Posted: Sun Mar 30, 2025 12:51 AM

Dear Vilian

I've reviewed the latest changes made to classes that may affect this issue, and I haven't seen any significant changes that could alter the behavior compared to previous versions.

Can you provide me with a .sql file that can create the table (including the structure you use) and with some example rows?

Thanks

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Problem with numeric fields and FWH 25.01
Posted: Sun Mar 30, 2025 05:36 PM
vilian wrote: Dear Cristobal,

The type of the fields is:

QTE DECIMAL(11,3)
VALOR DECIMAL(12,4)
I saw many topic on web with problems on MariaDb and Decimals


one man give me this link perhaps can help you
https://docs.oracle.com/javase/8/docs/api/java/text/NumberFormat.html
https://mariadb.com/kb/en/decimal/
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Problem with numeric fields and FWH 25.01
Posted: Sun Mar 30, 2025 06:42 PM
vilian wrote: Hi Guys,
IF I run the code bellow with my previous version of FWH. I can see the value 3.3732. But if i run this same code with the new version of FWH, the value showed is 3.37. Do you know why ?

function Main()
LOCAL oRs,oCn,oError,oQry,cQryMat

   SET DATE BRIT
   SET CENTURY ON
   
   CursorWait()

   oCn := Maria_Connect( aStr[1] )

   oRs := oCn:Query("SELECT nfiscal,cmat,qte,qtedig FROM consumo WHERE nfiscal LIKE '000005829%'")
   cQryMat := ""
   DO WHILE .NOT. oRs:Eof()
      cQryMat += "'"+oRs:cmat+"',"
      ? oRs:qte,oRs:qtedig,oRs:cmat
      oRs:Skip()
   ENDDO
   oRs:GoTop()
   
RETURN NIL
Dear Silvio
We'll have to try to find out why it worked correctly with the previous version ( 23.11 ), but not with the current one, right?
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Problem with numeric fields and FWH 25.01
Posted: Mon Mar 31, 2025 10:42 AM

Yes.

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Problem with numeric fields and FWH 25.01
Posted: Thu Apr 10, 2025 12:33 PM
Any Progress?
I really wanted update my FWH version to try webview2, but with this problem, I can't do it :(
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Problem with numeric fields and FWH 25.01
Posted: Thu Apr 10, 2025 02:36 PM
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Problem with numeric fields and FWH 25.01
Posted: Thu Apr 10, 2025 05:33 PM

I sent it again to your email. please, let me know if you need something else.

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Problem with numeric fields and FWH 25.01
Posted: Thu Apr 10, 2025 05:48 PM

We need a little sample to reproduce the problem. The sample must be compilable and runnable without any not available external dependencies (database included).

Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Problem with numeric fields and FWH 25.01
Posted: Thu Apr 10, 2025 06:30 PM

Hi Enrico,

I sent it by email to Cristobal.

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Problem with numeric fields and FWH 25.01
Posted: Thu Apr 10, 2025 07:23 PM

Ok, so you have to wait for Cristobal's answer.

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Problem with numeric fields and FWH 25.01
Posted: Sun Apr 20, 2025 03:13 PM
Dear Vilian,

Thanks to Hakan Öztürk as has found the difference in the code :D

It seems as Mr. Rao changed a call to hb_valStrnToNum() into a call to hb_strnToNum()

According to Mr. Rao's notes:
#ifdef REMOVED
/*
               hb_arraySetND( aRow, i + 1, ( mrow[ i ] == NULL ? 0.0 : hb_strVal( mrow[ i ], aLen[ i ] ) ) );
               break;  // loss of accuracy in case of bigint large numbers
*/

/*
               // nor working in case of double datatpe with large numbers
               if( ! hb_valStrnToNum( mrow[ i ], aLen[ i ], &lValue, &dValue, &iDec, &iWidth ) )
               {
                  hb_arraySetNL( aRow, i + 1, ( long ) lValue );
               }
               else
               {
                  hb_itemPutNDLen( itemTmp, dValue, iWidth, iDec );
                  hb_arraySetForward( aRow, i + 1, itemTmp );
               }

               break;
*/
#endif
The modified code uses this now:
            case 'N':

               if ( ( nAt = ( int ) hb_strAtI( "e", 1, mrow[ i ], aLen[ i ] ) ) > 0 )
               {
                  dValue = hb_strVal( mrow[ i ], aLen[ i ] );
                  x = ( int ) hb_strVal( mrow[ i ] + nAt, aLen[ i ] - nAt );
                  dValue *= pow( ( double ) 10.0, ( double ) x );
                  hb_arraySetND( aRow, i + 1, dValue );
               }
               else
               {
                  if ( hb_strnToNum( mrow[ i ], aLen[ i ], &lValue, &dValue ) )
                  {
                     hb_arraySetND( aRow, i + 1, dValue );
                  }
                  else
                  {
                     hb_arraySetNLL( aRow, i + 1, lValue );
                  }
               }
               break;
We can revert this change and send you a modified lib for your testing. Please let me know if you want it for 32 or 64 bits ? Borland or MSVC ? many thanks!
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Problem with numeric fields and FWH 25.01
Posted: Tue Apr 22, 2025 11:04 AM

Dear Antonio,

I'm using Borland/32bits.

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 61
Joined: Wed Jul 26, 2023 12:08 PM
Re: Problem with numeric fields and FWH 25.01
Posted: Tue Apr 22, 2025 12:34 PM
Hi Vilian,

Can you solved your lost connection problems?

Best Regards,

Ertan Hakan ÖZTÜRK
ertan_ozturk@yahoo.com
Best regards,
Ertan,

ertan_ozturk@yahoo.com
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Problem with numeric fields and FWH 25.01
Posted: Tue Apr 22, 2025 12:45 PM
Yes ;)
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Problem with numeric fields and FWH 25.01
Posted: Wed Apr 30, 2025 10:35 AM
Antonio Linares wrote: Dear Vilian,

Thanks to Hakan Öztürk as has found the difference in the code :D

It seems as Mr. Rao changed a call to hb_valStrnToNum() into a call to hb_strnToNum()

According to Mr. Rao's notes:
#ifdef REMOVED
/*
               hb_arraySetND( aRow, i + 1, ( mrow[ i ] == NULL ? 0.0 : hb_strVal( mrow[ i ], aLen[ i ] ) ) );
               break;  // loss of accuracy in case of bigint large numbers
*/

/*
               // nor working in case of double datatpe with large numbers
               if( ! hb_valStrnToNum( mrow[ i ], aLen[ i ], &lValue, &dValue, &iDec, &iWidth ) )
               {
                  hb_arraySetNL( aRow, i + 1, ( long ) lValue );
               }
               else
               {
                  hb_itemPutNDLen( itemTmp, dValue, iWidth, iDec );
                  hb_arraySetForward( aRow, i + 1, itemTmp );
               }

               break;
*/
#endif
The modified code uses this now:
            case 'N':

               if ( ( nAt = ( int ) hb_strAtI( "e", 1, mrow[ i ], aLen[ i ] ) ) > 0 )
               {
                  dValue = hb_strVal( mrow[ i ], aLen[ i ] );
                  x = ( int ) hb_strVal( mrow[ i ] + nAt, aLen[ i ] - nAt );
                  dValue *= pow( ( double ) 10.0, ( double ) x );
                  hb_arraySetND( aRow, i + 1, dValue );
               }
               else
               {
                  if ( hb_strnToNum( mrow[ i ], aLen[ i ], &lValue, &dValue ) )
                  {
                     hb_arraySetND( aRow, i + 1, dValue );
                  }
                  else
                  {
                     hb_arraySetNLL( aRow, i + 1, lValue );
                  }
               }
               break;
We can revert this change and send you a modified lib for your testing. Please let me know if you want it for 32 or 64 bits ? Borland or MSVC ? many thanks!
Good Morning Antonio,
When will it be available to me ?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil