Re: WAS Strange non-display problem, now BAD MATH

This WebDNA talk-list message is from

2002


It keeps the original formatting.
numero = 45980
interpreted = N
texte = Hi Larry,Thanks for that, but probably sorry I asked ;-) lolRegards, Tim> From: Larry Goodhew > Reply-To: (WebCatalog Talk) > Date: Wed, 4 Dec 2002 17:58:26 -0800 > To: (WebCatalog Talk) > Subject: Re: WAS Strange non-display problem, now BAD MATH > > Hi Tim, > > It is kind of involved but what I meant is that if you have a bunch of real > numbers (Real number are numbers with decimal points like: 1001.1, or 1002.1 > or > 1002.3 etc.) not all of those numbers can be stored in binary representation. > That is why, in many financial programs, the numbers are not stored in binary > representation, because people are not amused by rounding errors when they > balance their checkbook. > > When you use a math function on a real number in WebCatalog you are doing math > with the binary representation of the number, which is just a bunch of zeros > and ones, not the decimal number you entered. There is a finite number of > real > numbers that you can store in a binary 32 or 64 bits. There is an infinite > number of real numbers between any two real numbers you choose. So you can > see > that there is no way to represent an infinite number of real numbers in a > finite number of bits. The representations become approximations. Some are > better than others but few are perfectly represented. > > Hope that explains it better! > > Larry Goodhew > >> >> Hi Larry, >> >> I don't really get what you mean? A number's a number isn't it? And this >> subtraction couldn't be more simple. I mean, it works on my onscreen Apple >> calculator.... >> >> Tim >> >> >>> From: Larry Goodhew >>> Reply-To: (WebCatalog Talk) >>> Date: Wed, 4 Dec 2002 17:10:48 -0800 >>> To: (WebCatalog Talk) >>> Subject: Re: WAS Strange non-display problem, now BAD MATH >>> >>> I imagine all the decimal places are caused by the fact that very few real >>> numbers can be represented correctly in base two. Once you start doing math >>> with them the slight errors in representation begin to add up and cause the >>> type of error you are seeing here. >>> >>> Larry Goodhew >>> >>>> >>>> >>>> It seems that the problem has been fixed by making [Format thousands] into >>>> [Format thousands .2f]. It is now working consistently. But the problems >>>> seems to have been caused by bad math!!! >>>> >>>> For example, here's a few of the variables. >>>> >>>> 2002_SALES_2=125360.1 >>>> SAP_SALES_2=123000 >>>> but >>>> [math][SAP_SALES_2]-[2002_SALES_2][/math]= -2360.10000000001 >>>> >>>> Where did all the decimals places come from?!?! It terms of a [math] >>>> calculation, this is pretty bloody easy. I could probably come closer to >>>> that >>>> in my head! (well at least in terms of decimal places...) >>>> >>>> What's going on here?!?! And now i find when you add the [Format thousands >>>> .2f] to a value, it can't display the 'minus' of the negative value..... >>>> >>>> Any ideas on this bad math? >>>> >>>> Regards, >>>> Tim >>>> >>>> >>>> >>>>> From: Gary Krockover >>>>> Reply-To: (WebCatalog Talk) >>>>> Date: Wed, 4 Dec 2002 17:24:13 -0600 >>>>> To: (WebCatalog Talk) >>>>> Subject: Re: Strange non-display problem >>>>> >>>>> Are some of the cells coming back empty and thus collapsing? Add a >>>>> non-breaking space to all the cells:   >>>>> >>>>> That will at least keep the cells from collapsing. >>>>> >>>>> And not sure, but maybe the other dates in this search need to be id'd as >>>>> dates: >>>>> >>>>> From: >>>>> [Search >>>>> db=data/directsales.db&rnSALEDATEdata=[DATE_RANGE1a],[DATE_RANGE1b]&SALEDA >>>>> TE >>>>> type=date&saledatewbrk=,] [text show=F][START_YEAR]_SALES_1=[Sum >>>>> field=sale_total][/text] [/Search] >>>>> >>>>> To: >>>>> [Search >>>>> db=data/directsales.db&rnSALEDATEdata=[DATE_RANGE1a],[DATE_RANGE1b]&SALEDA >>>>> TE >>>>> type=date&DATE_RANGE1atype=date&DATE_RANGE1btype=date&saledatewbrk=,] >>>>> [text >>>>> show=F][START_YEAR]_SALES_1=[Sum field=sale_total][/text] [/Search] >>>>> >>>>> On your lookups, substitue a high value, like 9999 for TextIfNotFound >>>>> and >>>>> see if that is getting added to the value. Perhaps the lookups are >>>>> failing >>>>> and the math isn't working because the 'not found' is a text string. >>>>> >>>>> GK >>>>> >>>>> >>>>> >>>>> | Hi everyone, >>>>> | >>>>> | I'm getting a very strange behaviour in a financial reporting table only >>>>> 7 >>>>> | columns wide, and 12 rows high (one row for each month). TD cells are >>>>> filled | with a variety of information - a search, two lookups, and >>>>> calculations on | those values. | | The table displays something different >>>>> every time.... sometimes there is | nothing in the cell, sometimes the >>>>> correct value, and sometimes the WRONG | value. But when I do a list >>>>> variables at the bottom of the page, ALL | variables have the correct >>>>> value!! | | I initially had the 12 month rows working as a loop, but the >>>>> results were | even worse! Having manually coded the 12 months, it's >>>>> better >>>>> but still | inconsistent. The loop solution should've worked properly, and >>>>> so should | this. | | The values that seems to drop out most often are >>>>> [SAP_SALES_1] and | [BUDGET_SALES_1]. But to prove I'm not mad, the last >>>>> two >>>>> columns ALWAYS | work, even though they use these two fields for the >>>>> calculations.... | | Does anyone have any ideas? All help greatly >>>>> appreciated as always. I've | copied relevant code below. | | Regards, | >>>>> Tim >>>>> | -- | Tim Robinson | IDFK Web Developments | tim@idfk.com.au | 114a/40 >>>>> Yeo >>>>> Street | Neutral Bay 2089 | Australia | Phone +612 9908 2134 | Fax >>>>> +612 9908 4837 | | | | | [TEXT show=f]START_YEAR=2002[/TEXT] | | >>>>> >>>> border=0 cellpadding=6 cellspacing=2 id=text> | >>>> id=whitetext> | Month Ending | >>>> align=right>COMS >>>>> Sales | SAP Sales | >>>> align=right>Sys Var | Budget | >>>>> >>>> align=center colspan=2>Budget Var | | | [Search | >>>>> db=data/directsales.db&rnSALEDATEdata=[DATE_RANGE1a],[DATE_RANGE1b]&SALEDA >>>>> TE >>>>> | type=date&saledatewbrk=,] | [text show=F][START_YEAR]_SALES_1=[Sum >>>>> field=sale_total][/text] | [/Search] | | [TEXT >>>>> show=F]SAP_SALES_1=[LOOKUP | >>>>> db=data/SAP_sales.db&value=[START_YEAR]_1&lookInField=SKU&returnField=SAP_ >>>>> SA >>>>> | LES¬Found=TextIfNotFound][/TEXT] | | [TEXT | >>>>> show=F]SYS_VAR_1=[math][SAP_SALES_1]-[interpret][[START_YEAR]_SALES_1][/in >>>>> te >>>>> | rpret][/math][/TEXT] | | [TEXT show=F]BUDGET_SALES_1=[LOOKUP | >>>>> db=data/SAP_sales.db&value=[START_YEAR]_1&lookInField=SKU&returnField=BUDG >>>>> ET >>>>> | _SALES¬Found=TextIfNotFound][/TEXT] | | [TEXT >>>>> show=F]BUDGET_VAR_1=[math][SAP_SALES_1]-[BUDGET_SALES_1][/math][/TEXT] | | >>>>> [TEXT | >>>>> show=F]VAR_PERCENT_1=[math][BUDGET_VAR_1]/[BUDGET_SALES_1]*100[/math][/TEX >>>>> T] >>>>> | | | [DATE_RANGE1b] | >>>> align=right>[Format thousands | >>>>> .2f][interpret][[START_YEAR]_SALES_1][/interpret][/format] | >>>> align=right>[Format thousands][SAP_SALES_1][/format] | >>>> align=right>[Format thousands][SYS_VAR_1][/format] | >>>> align=right>[Format thousands][BUDGET_SALES_1][/format] | >>>> align=right>[Format thousands][BUDGET_VAR_1][/format] | >>>> align=right>[Format .2f][VAR_PERCENT_1][/format]% | | | | >>>>> Regards, | Tim | -- | Tim Robinson | IDFK Web Developments | >>>>> tim@idfk.com.au >>>>> | 114a/40 Yeo Street | Neutral Bay 2089 | Australia | Phone +612 9908 2134 >>>>> | >>>>> Fax >>>>> +612 9908 4837 | | | | >>>>> ------------------------------------------------------------- | This >>>>> message >>>>> is sent to you because you are subscribed to | the mailing list >>>>> . | To unsubscribe, E-mail to: >>>>> | To switch to the DIGEST mode, >>>>> E-mail >>>>> to | Web Archive of this list is >>>>> at: http://webdna.smithmicro.com/ >>>>> >>>>> >>>>> ------------------------------------------------------------- >>>>> This message is sent to you because you are subscribed to >>>>> the mailing list . >>>>> To unsubscribe, E-mail to: >>>>> To switch to the DIGEST mode, E-mail to >>>>> >>>>> Web Archive of this list is at: http://webdna.smithmicro.com/ >>>>> >>>> >>>> >>>> >>>> ------------------------------------------------------------- >>>> This message is sent to you because you are subscribed to >>>> the mailing list . >>>> To unsubscribe, E-mail to: >>>> To switch to the DIGEST mode, E-mail to >>>> >>>> Web Archive of this list is at: http://webdna.smithmicro.com/ >>>> >>> >>> >>> >>> ------------------------------------------------------------- >>> This message is sent to you because you are subscribed to >>> the mailing list . >>> To unsubscribe, E-mail to: >>> To switch to the DIGEST mode, E-mail to >>> >>> Web Archive of this list is at: http://webdna.smithmicro.com/ >>> >> >> >> >> ------------------------------------------------------------- >> This message is sent to you because you are subscribed to >> the mailing list . >> To unsubscribe, E-mail to: >> To switch to the DIGEST mode, E-mail to >> >> Web Archive of this list is at: http://webdna.smithmicro.com/ >> > > > > ------------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > To switch to the DIGEST mode, E-mail to > > Web Archive of this list is at: http://webdna.smithmicro.com/ > ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: WAS Strange non-display problem, now BAD MATH (Tim Robinson 2002)
  2. Re: WAS Strange non-display problem, now BAD MATH (Larry Goodhew 2002)
  3. Re: WAS Strange non-display problem, now BAD MATH (Tim Robinson 2002)
  4. Re: WAS Strange non-display problem, now BAD MATH (Larry Goodhew 2002)
  5. WAS Strange non-display problem, now BAD MATH (Tim Robinson 2002)
Hi Larry,Thanks for that, but probably sorry I asked ;-) lolRegards, Tim> From: Larry Goodhew > Reply-To: (WebCatalog Talk) > Date: Wed, 4 Dec 2002 17:58:26 -0800 > To: (WebCatalog Talk) > Subject: Re: WAS Strange non-display problem, now BAD MATH > > Hi Tim, > > It is kind of involved but what I meant is that if you have a bunch of real > numbers (Real number are numbers with decimal points like: 1001.1, or 1002.1 > or > 1002.3 etc.) not all of those numbers can be stored in binary representation. > That is why, in many financial programs, the numbers are not stored in binary > representation, because people are not amused by rounding errors when they > balance their checkbook. > > When you use a math function on a real number in WebCatalog you are doing math > with the binary representation of the number, which is just a bunch of zeros > and ones, not the decimal number you entered. There is a finite number of > real > numbers that you can store in a binary 32 or 64 bits. There is an infinite > number of real numbers between any two real numbers you choose. So you can > see > that there is no way to represent an infinite number of real numbers in a > finite number of bits. The representations become approximations. Some are > better than others but few are perfectly represented. > > Hope that explains it better! > > Larry Goodhew > >> >> Hi Larry, >> >> I don't really get what you mean? A number's a number isn't it? And this >> subtraction couldn't be more simple. I mean, it works on my onscreen Apple >> calculator.... >> >> Tim >> >> >>> From: Larry Goodhew >>> Reply-To: (WebCatalog Talk) >>> Date: Wed, 4 Dec 2002 17:10:48 -0800 >>> To: (WebCatalog Talk) >>> Subject: Re: WAS Strange non-display problem, now BAD MATH >>> >>> I imagine all the decimal places are caused by the fact that very few real >>> numbers can be represented correctly in base two. Once you start doing math >>> with them the slight errors in representation begin to add up and cause the >>> type of error you are seeing here. >>> >>> Larry Goodhew >>> >>>> >>>> >>>> It seems that the problem has been fixed by making [Format thousands] into >>>> [Format thousands .2f]. It is now working consistently. But the problems >>>> seems to have been caused by bad math!!! >>>> >>>> For example, here's a few of the variables. >>>> >>>> 2002_SALES_2=125360.1 >>>> SAP_SALES_2=123000 >>>> but >>>> [math][SAP_SALES_2]-[2002_SALES_2][/math]= -2360.10000000001 >>>> >>>> Where did all the decimals places come from?!?! It terms of a [math] >>>> calculation, this is pretty bloody easy. I could probably come closer to >>>> that >>>> in my head! (well at least in terms of decimal places...) >>>> >>>> What's going on here?!?! And now i find when you add the [Format thousands >>>> .2f] to a value, it can't display the 'minus' of the negative value..... >>>> >>>> Any ideas on this bad math? >>>> >>>> Regards, >>>> Tim >>>> >>>> >>>> >>>>> From: Gary Krockover >>>>> Reply-To: (WebCatalog Talk) >>>>> Date: Wed, 4 Dec 2002 17:24:13 -0600 >>>>> To: (WebCatalog Talk) >>>>> Subject: Re: Strange non-display problem >>>>> >>>>> Are some of the cells coming back empty and thus collapsing? Add a >>>>> non-breaking space to all the cells:   >>>>> >>>>> That will at least keep the cells from collapsing. >>>>> >>>>> And not sure, but maybe the other dates in this search need to be id'd as >>>>> dates: >>>>> >>>>> From: >>>>> [Search >>>>> db=data/directsales.db&rnSALEDATEdata=[DATE_RANGE1a],[DATE_RANGE1b]&SALEDA >>>>> TE >>>>> type=date&saledatewbrk=,] [text show=F][START_YEAR]_SALES_1=[Sum >>>>> field=sale_total][/text] [/Search] >>>>> >>>>> To: >>>>> [Search >>>>> db=data/directsales.db&rnSALEDATEdata=[DATE_RANGE1a],[DATE_RANGE1b]&SALEDA >>>>> TE >>>>> type=date&DATE_RANGE1atype=date&DATE_RANGE1btype=date&saledatewbrk=,] >>>>> [text >>>>> show=F][START_YEAR]_SALES_1=[Sum field=sale_total][/text] [/Search] >>>>> >>>>> On your lookups, substitue a high value, like 9999 for TextIfNotFound >>>>> and >>>>> see if that is getting added to the value. Perhaps the lookups are >>>>> failing >>>>> and the math isn't working because the 'not found' is a text string. >>>>> >>>>> GK >>>>> >>>>> >>>>> >>>>> | Hi everyone, >>>>> | >>>>> | I'm getting a very strange behaviour in a financial reporting table only >>>>> 7 >>>>> | columns wide, and 12 rows high (one row for each month). TD cells are >>>>> filled | with a variety of information - a search, two lookups, and >>>>> calculations on | those values. | | The table displays something different >>>>> every time.... sometimes there is | nothing in the cell, sometimes the >>>>> correct value, and sometimes the WRONG | value. But when I do a list >>>>> variables at the bottom of the page, ALL | variables have the correct >>>>> value!! | | I initially had the 12 month rows working as a loop, but the >>>>> results were | even worse! Having manually coded the 12 months, it's >>>>> better >>>>> but still | inconsistent. The loop solution should've worked properly, and >>>>> so should | this. | | The values that seems to drop out most often are >>>>> [SAP_SALES_1] and | [BUDGET_SALES_1]. But to prove I'm not mad, the last >>>>> two >>>>> columns ALWAYS | work, even though they use these two fields for the >>>>> calculations.... | | Does anyone have any ideas? All help greatly >>>>> appreciated as always. I've | copied relevant code below. | | Regards, | >>>>> Tim >>>>> | -- | Tim Robinson | IDFK Web Developments | tim@idfk.com.au | 114a/40 >>>>> Yeo >>>>> Street | Neutral Bay 2089 | Australia | Phone +612 9908 2134 | Fax >>>>> +612 9908 4837 | | | | | [TEXT show=f]START_YEAR=2002[/TEXT] | | >>>>> >>>> border=0 cellpadding=6 cellspacing=2 id=text> | >>>> id=whitetext> | Month Ending | >>>> align=right>COMS >>>>> Sales | SAP Sales | >>>> align=right>Sys Var | Budget | >>>>> >>>> align=center colspan=2>Budget Var | | | [Search | >>>>> db=data/directsales.db&rnSALEDATEdata=[DATE_RANGE1a],[DATE_RANGE1b]&SALEDA >>>>> TE >>>>> | type=date&saledatewbrk=,] | [text show=F][START_YEAR]_SALES_1=[Sum >>>>> field=sale_total][/text] | [/Search] | | [TEXT >>>>> show=F]SAP_SALES_1=[LOOKUP | >>>>> db=data/SAP_sales.db&value=[START_YEAR]_1&lookInField=SKU&returnField=SAP_ >>>>> SA >>>>> | LES¬Found=TextIfNotFound][/TEXT] | | [TEXT | >>>>> show=F]SYS_VAR_1=[math][SAP_SALES_1]-[interpret][[START_YEAR]_SALES_1][/in >>>>> te >>>>> | rpret][/math][/TEXT] | | [TEXT show=F]BUDGET_SALES_1=[LOOKUP | >>>>> db=data/SAP_sales.db&value=[START_YEAR]_1&lookInField=SKU&returnField=BUDG >>>>> ET >>>>> | _SALES¬Found=TextIfNotFound][/TEXT] | | [TEXT >>>>> show=F]BUDGET_VAR_1=[math][SAP_SALES_1]-[BUDGET_SALES_1][/math][/TEXT] | | >>>>> [TEXT | >>>>> show=F]VAR_PERCENT_1=[math][BUDGET_VAR_1]/[BUDGET_SALES_1]*100[/math][/TEX >>>>> T] >>>>> | | | [DATE_RANGE1b] | >>>> align=right>[Format thousands | >>>>> .2f][interpret][[START_YEAR]_SALES_1][/interpret][/format] | >>>> align=right>[Format thousands][SAP_SALES_1][/format] | >>>> align=right>[Format thousands][SYS_VAR_1][/format] | >>>> align=right>[Format thousands][BUDGET_SALES_1][/format] | >>>> align=right>[Format thousands][BUDGET_VAR_1][/format] | >>>> align=right>[Format .2f][VAR_PERCENT_1][/format]% | | | | >>>>> Regards, | Tim | -- | Tim Robinson | IDFK Web Developments | >>>>> tim@idfk.com.au >>>>> | 114a/40 Yeo Street | Neutral Bay 2089 | Australia | Phone +612 9908 2134 >>>>> | >>>>> Fax >>>>> +612 9908 4837 | | | | >>>>> ------------------------------------------------------------- | This >>>>> message >>>>> is sent to you because you are subscribed to | the mailing list >>>>> . | To unsubscribe, E-mail to: >>>>> | To switch to the DIGEST mode, >>>>> E-mail >>>>> to | Web Archive of this list is >>>>> at: http://webdna.smithmicro.com/ >>>>> >>>>> >>>>> ------------------------------------------------------------- >>>>> This message is sent to you because you are subscribed to >>>>> the mailing list . >>>>> To unsubscribe, E-mail to: >>>>> To switch to the DIGEST mode, E-mail to >>>>> >>>>> Web Archive of this list is at: http://webdna.smithmicro.com/ >>>>> >>>> >>>> >>>> >>>> ------------------------------------------------------------- >>>> This message is sent to you because you are subscribed to >>>> the mailing list . >>>> To unsubscribe, E-mail to: >>>> To switch to the DIGEST mode, E-mail to >>>> >>>> Web Archive of this list is at: http://webdna.smithmicro.com/ >>>> >>> >>> >>> >>> ------------------------------------------------------------- >>> This message is sent to you because you are subscribed to >>> the mailing list . >>> To unsubscribe, E-mail to: >>> To switch to the DIGEST mode, E-mail to >>> >>> Web Archive of this list is at: http://webdna.smithmicro.com/ >>> >> >> >> >> ------------------------------------------------------------- >> This message is sent to you because you are subscribed to >> the mailing list . >> To unsubscribe, E-mail to: >> To switch to the DIGEST mode, E-mail to >> >> Web Archive of this list is at: http://webdna.smithmicro.com/ >> > > > > ------------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > To switch to the DIGEST mode, E-mail to > > Web Archive of this list is at: http://webdna.smithmicro.com/ > ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Tim Robinson

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

WCS Newbie question (1997) WebCat b13 CGI -shownext- (1997) Search all Fields in a db (1997) GoLive CyberStudio 1.0.1 (1997) Re:Realtime Transaction Processing (1999) New public beta available (1997) [OT] Java Scroller (2006) Calculating multiple shipping... (1997) Max Record length (1997) Duplicate Cart Problem in Netscape (2000) name of file (2002) WC1.6 to WC2 date formatting (1997) [WriteFile] problems (1997) Credit card processing - UK (1997) [OT] Graphic Art Services (2004) RE: Formulas.db + Users.db (1997) Performance Issue (2000) WebCat editing, SiteGuard & SiteEdit (1997) [WebDNA] Interesting business model (2010) Shop till you drop dead on the avenue ... (1997)