Author | Topic: This Problem Is Driving Me Crazy : STK_QTY-ROUND(STK_QTY,4) = -0.00000000000000044409 ??? | |
---|---|---|
Jimmy Huang | This Problem Is Driving Me Crazy : STK_QTY-ROUND(STK_QTY,4) = -0.00000000000000044409 ??? on Fri, 26 Aug 2016 17:30:15 +0800 Dear All, I Found a Strange Problem of Numberic field, Some record of number filed has a little little tail, fox example: STK_QTY-ROUND(STK_QTY,4) = -0.00000000000000044409, and STK_QTY is field name, Length = 15 , Dec = 4. Please refer to the attachment (My Xbase Version is 2.00.575 Feb 17 2015) This Problem Is Driving Me Crazy PLEASE HELP ME!!!! ??? B & R Jimmy Huang From RSIDG.COM Huang Administrator.vcf CorrDec_Dbf.zip | |
Andreas Gehrs-Pahl | Re: This Problem Is Driving Me Crazy : STK_QTY-ROUND(STK_QTY,4) = -0.00000000000000044409 ??? on Thu, 01 Sep 2016 14:43:20 -0400 Jimmy, >Please refer to the attachment (My Xbase Version is 2.00.575 Feb 17 2015) This problem only appeared on 64-bit machines and has been fixed by now, so it doesn't happen with versions after 2.00.598, anymore. The current version is 2.00.726, released 08/29/2016. This seems to be described in PDR 109-6678, which was closed over two years ago, on 06/29/2015, with version 2.00.598. I suggest you update to a newer version or use a 32-bit OS with 2.00.575. Hope that helps, Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas@AbsoluteSoftwareLLC.com web: http://www.AbsoluteSoftwareLLC.com [F]: https://www.facebook.com/AbsoluteSoftwareLLC | |
Jimmy Huang | Re: This Problem Is Driving Me Crazy : STK_QTY-ROUND(STK_QTY,4) = -0.00000000000000044409 ??? on Wed, 07 Sep 2016 21:53:19 +0800 Hi Andreas, Thank you for advising me! Unfortunately our license is expired, can not update to newer version with workbench, I will try to call alaska people for this. B&R Jimmy Huang ---------------------------------------------------------------------- Mobile: (+86)189-3820-1558 / (+86)135-3259-9935 Tel: (+86)0769-81360887 E-mail: JimmyHuang@rsidg.com Skype: jimmyhuangdg@hotmail.com Web : Http://www.rsidg.com ---------------------------------------------------------------------------------------------------------------------------- Jimmy, >Please refer to the attachment (My Xbase Version is 2.00.575 Feb 17 2015) This problem only appeared on 64-bit machines and has been fixed by now, so it doesn't happen with versions after 2.00.598, anymore. The current version is 2.00.726, released 08/29/2016. This seems to be described in PDR 109-6678, which was closed over two years ago, on 06/29/2015, with version 2.00.598. I suggest you update to a newer version or use a 32-bit OS with 2.00.575. Hope that helps, Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas@AbsoluteSoftwareLLC.com web: http://www.AbsoluteSoftwareLLC.com [F]: https://www.facebook.com/AbsoluteSoftwareLLC | |
Jimmy Huang | Re: This Problem Is Driving Me Crazy : STK_QTY-ROUND(STK_QTY,4) = -0.00000000000000044409 ??? on Sat, 26 Mar 2022 22:15:14 +0800 Hi Experts, few days ago, I tested the new version - trial Edition 2.0 Build:1503, It looks the problem still there, sometimes when calculating the comparison of some numbers, "greater than" or "less than" or "equal" to the comparison, the system can not give the correct result, and later found that there will be some "tail" hidden behind some values, Do you have the same problem? jimmy Huang --------------------------- On 2016-09-07 21:53, Jimmy Huang wrote: > Hi Andreas, > > Thank you for advising me! > Unfortunately our license is expired, can not update to newer version > with workbench, I will try to call alaska people for this. > > B&R > > Jimmy Huang > ---------------------------------------------------------------------- > Mobile: (+86)189-3820-1558 / (+86)135-3259-9935 > Tel: (+86)0769-81360887 > E-mail: JimmyHuang@rsidg.com > Skype: jimmyhuangdg@hotmail.com > Web : Http://www.rsidg.com > ---------------------------------------------------------------------------------------------------------------------------- > > Jimmy, > >> Please refer to the attachment (My Xbase Version is 2.00.575 Feb 17 2015) > > This problem only appeared on 64-bit machines and has been fixed by now, so > it doesn't happen with versions after 2.00.598, anymore. The current > version > is 2.00.726, released 08/29/2016. > > This seems to be described in PDR 109-6678, which was closed over two years > ago, on 06/29/2015, with version 2.00.598. > > I suggest you update to a newer version or use a 32-bit OS with 2.00.575. > > Hope that helps, > > Andreas Jimmy Huang Picture01.png Picture02.png Xb2022Test.zip | |
Boris Borzic | Re: This Problem Is Driving Me Crazy : STK_QTY-ROUND(STK_QTY,4) = -0.00000000000000044409 ??? on Sun, 27 Mar 2022 19:24:24 +0200 Jimmy Huang wrote in news:733d2cce$37d45d9c$6cef9@news.alaska-software.com: > few days ago, I tested the new version - trial Edition 2.0 Build:1503O > It looks the problem still there, sometimes when calculating the > comparison of some numbers, "greater than" or "less than" or "equal" to > the comparison, the system can not give the correct result, and later > found that there will be some "tail" hidden behind some values, Do you > have the same problem? This is a result of using floating-point numbers. One way to deal with it is to create UDF's. Here is my UDF for checking if a value is zero: #xtranslate IsZero(<n>) => Abs(<n>) \< 0.005 instead of this: if nVal == 0 replace with this: if IsZero(nVal) Best regards, Boris Borzic http://xb2.net http://sqlexpress.net industrial strength Xbase++ development tools | |
Jimmy Huang | Re: This Problem Is Driving Me Crazy : STK_QTY-ROUND(STK_QTY,4) = -0.00000000000000044409 ??? on Tue, 29 Mar 2022 00:35:48 +0800 On 2022-03-28 1:24, Boris Borzic wrote: > Jimmy Huang wrote in news:733d2cce$37d45d9c$6cef9@news.alaska-software.com: > >> few days ago, I tested the new version - trial Edition 2.0 Build:1503‹¬O >> It looks the problem still there, sometimes when calculating the >> comparison of some numbers, "greater than" or "less than" or "equal" to >> the comparison, the system can not give the correct result, and later >> found that there will be some "tail" hidden behind some values, Do you >> have the same problem? > > This is a result of using floating-point numbers. > > One way to deal with it is to create UDF's. Here is my UDF for checking if > a value is zero: > > #xtranslate IsZero(<n>) => Abs(<n>) \< 0.005 > > instead of this: > if nVal == 0 > > replace with this: > if IsZero(nVal) > > Hi Borzic, Thank you very much for your reply! I also found a temporary way to deal with this problem: /************************************/ FUNCTION NumComp(nVal1,cMompare,nVal2) LOCAL xResult := .F. nVal1 = ROUND(nVal1,SYS_QTY_DEC) /*in my environment SYS_QTY_DEC=6 */ nVal2 = ROUND(nVal2,SYS_QTY_DEC) DO CASE CASE cMompare == ">" xResult = nVal1 > nVal2 CASE cMompare == ">=" xResult = nVal1 >= nVal2 CASE cMompare == "<" xResult = nVal1 < nVal2 CASE cMompare == "<=" xResult = nVal1 <= nVal2 CASE cMompare == "==" xResult = nVal1 == nVal2 CASE cMompare == "=" xResult = nVal1 = nVal2 ENDCASE RETURN xResult /************************************/ Best Regards, ------------------------------------- Jimmy Huang ------------------------------------- |