[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Re: [Tomasz] 1 / 0 = 0? : NaN or Infinity would be good



PureBytes Links

Trading Reference Links

John,

It won't get unnoticed simply because plotting 1/0 will give you huge
spikes.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "John" <jr-sw@xxxxxxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, March 04, 2003 10:37 AM
Subject: Re: [amibroker] Re: [Tomasz] 1 / 0 = 0? : NaN or Infinity would be good


> Tomasz,
> 
> The proposed functions sound good and would be far more convenient than
> IIFs.
> 
> But....(why is there always a but?).. if I forget to use the appropriate
> function in my code (i.e. I do not *anticipate* the condition) then will the
> AFL engine display a Divide by Zero error message when I attempt to plot or
> use the code? If it does not then my concern is the condition will go
> undetected. IMO AFL engine should display message identifying the errror and
> bar - the user can then take appropriate action - either adding one of the
> proposed new functions to code or correcting the basic logic error in code.
> 
> Sorry to go on about this but I just don't like the idea of "errors" going
> unreported.
> 
> John
> 
> ----- Original Message -----
> From: "Tomasz Janeczko" <amibroker@xxxxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Tuesday, March 04, 2003 8:42 AM
> Subject: Re: [amibroker] Re: [Tomasz] 1 / 0 = 0? : NaN or Infinity would be
> good
> 
> 
> > John,
> >
> > In the case you mentioned a very high value (+infinite) will be plotted.
> >
> >
> > I was thinking about adding function like
> >
> > IsNan( array/number ) - detects NaN or
> > IsFinite( array/number ) - detects if the number is finite (not Nan nor
> infinite)
> >
> > Best regards,
> > Tomasz Janeczko
> > amibroker.com
> > ----- Original Message -----
> > From: "John" <jr-sw@xxxxxxxxxxxxxxxxx>
> > To: <amibroker@xxxxxxxxxxxxxxx>
> > Sent: Tuesday, March 04, 2003 1:27 AM
> > Subject: Re: [amibroker] Re: [Tomasz] 1 / 0 = 0? : NaN or Infinity would
> be good
> >
> >
> > > Tomasz or anyone else,
> > >
> > > Sorry but I am still clear how the proposed handling of Divide by Zero
> > > errors is going to work.
> > >
> > > What happens if for example we write some AFL custom indicator code
> like:-
> > >
> > > x=(H-L)/(C-L);
> > >
> > > When the Close is very near but not equal to the Low indicator plot
> value
> > > will be big. But when the Close matches the Low exactly the indicator
> plot
> > > value drops to Zero? I know this is the current AFL behaviour becuase I
> have
> > > been caught out by it before ;-)
> > >
> > > For the indicator to follow a logical progression IMO it should plot a
> > > bigger value when C-L is zero. So how will this be handled? Obviously
> one
> > > can write code to defend against anticipated zero divides (my Metastock
> > > indicators are full of these <g>) but without some error message from
> the
> > > AFL engine it seems to me un-anticipated zero divides will get by
> > > un-noticed.
> > >
> > > I am probably missing something here - it's late!
> > >
> > > John
> > >
> > > ----- Original Message -----
> > > From: "Tomasz Janeczko" <amibroker@xxxxxx>
> > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > Sent: Monday, March 03, 2003 6:41 PM
> > > Subject: Re: [amibroker] Re: [Tomasz] 1 / 0 = 0? : NaN or Infinity would
> be
> > > good
> > >
> > >
> > > > John,
> > > >
> > > > I don't think so.
> > > >
> > > > 1/0 will still be displayed as {NaN}
> > > >
> > > > But statement like this
> > > >
> > > > 100 / ( 1/ 0 )
> > > >
> > > > will give zero, which is correct considering the fact
> > > > that it could be rewritten to:
> > > >
> > > > 0  * 100/1
> > > >
> > > > Best regards,
> > > > Tomasz Janeczko
> > > > amibroker.com
> > > > ----- Original Message -----
> > > > From: "John" <jr-sw@xxxxxxxxxxxxxxxxx>
> > > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > > Sent: Monday, March 03, 2003 7:17 PM
> > > > Subject: Re: [amibroker] Re: [Tomasz] 1 / 0 = 0? : NaN or Infinity
> would
> > > be good
> > > >
> > > >
> > > > > Tomasz,
> > > > >
> > > > > If you take an automatic approach in AFL engine to Divide by Zero
> errors
> > > > > then won't any genuine user logic/coding errors get masked?
> > > > >
> > > > > John
> > > > > ----- Original Message -----
> > > > > From: "Tomasz Janeczko" <amibroker@xxxxxx>
> > > > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > > > Sent: Monday, March 03, 2003 5:26 PM
> > > > > Subject: Re: [amibroker] Re: [Tomasz] 1 / 0 = 0? : NaN or Infinity
> would
> > > be
> > > > > good
> > > > >
> > > > >
> > > > > > Mike,
> > > > > >
> > > > > > A next beta (4.29.8) will give you 100.
> > > > > >
> > > > > > Best regards,
> > > > > > Tomasz Janeczko
> > > > > > amibroker.com
> > > > > > ----- Original Message -----
> > > > > > From: <mik-u@xxxxxxxxxxx>
> > > > > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > > > > Sent: Monday, March 03, 2003 6:20 PM
> > > > > > Subject: [amibroker] Re: [Tomasz] 1 / 0 = 0? : NaN or Infinity
> would
> > > be
> > > > > good
> > > > > >
> > > > > >
> > > > > > > Hi Tomasz,
> > > > > > >
> > > > > > > NaN or Infinity would be good. I just need something to check an
> > > > > > > exception and get correct value (100) when calculating formula
> like
> > > > > > > this:
> > > > > > >
> > > > > > > 100 - 100 / (1 + 30 / 0)
> > > > > > >
> > > > > > > Regards,
> > > > > > > Mike
> > > > > > >
> > > > > > > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko"
> <amibroker@xxxx>
> > > > > > > wrote:
> > > > > > > > Hello,
> > > > > > > >
> > > > > > > > When I am thinking more on this... maybe it would be better
> > > > > > > > to display a special string "NaN" in such case?
> > > > > > > >
> > > > > > > > I will modify the WriteVal and this division handling so
> > > > > > > > it displays NaN string so it is more obvious what happens.
> > > > > > > >
> > > > > > > > Best regards,
> > > > > > > > Tomasz Janeczko
> > > > > > > > amibroker.com
> > > > > > > > ----- Original Message -----
> > > > > > > > From: "Tomasz Janeczko" <amibroker@xxxx>
> > > > > > > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > > > > > > Sent: Monday, March 03, 2003 8:57 AM
> > > > > > > > Subject: Re: [amibroker] [Tomasz] 1 / 0 = 0?
> > > > > > > >
> > > > > > > >
> > > > > > > > > Hello,
> > > > > > > > >
> > > > > > > > > (30/0) is NaN  - NOT a NUMBER
> > > > > > > > >
> > > > > > > > > Division by zero is illegal operation.
> > > > > > > > >
> > > > > > > > > If there was no protection against dividing by zero
> > > > > > > > > the program would just bomb out (crash and say good bye).
> > > > > > > > >
> > > > > > > > > Therefore when dividing two numbers X / Y AB checks
> > > > > > > > > if Y is equal to zero and always returns zero in that case.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > Best regards,
> > > > > > > > > Tomasz Janeczko
> > > > > > > > > amibroker.com
> > > > > > > > > ----- Original Message -----
> > > > > > > > > From: <mik-u@xxxx>
> > > > > > > > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > > > > > > > Sent: Monday, March 03, 2003 4:00 AM
> > > > > > > > > Subject: [amibroker] [Tomasz] 1 / 0 = 0?
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > > Tomasz,
> > > > > > > > > >
> > > > > > > > > > AB returning 0 for an expression like 1 / 0. Is it
> correct?
> > > > > > > > > >
> > > > > > > > > > The following expression
> > > > > > > > > >
> > > > > > > > > >    100 - 100 / (1 + 30 / 0)
> > > > > > > > > >
> > > > > > > > > > is equal 0 in AB, but I think it should be equal 100.
> > > > > > > > > >
> > > > > > > > > > Thanks,
> > > > > > > > > > Mike
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Send BUG REPORTS to bugs@xxxx
> > > > > > > > > > Send SUGGESTIONS to suggest@xxxx
> > > > > > > > > > -----------------------------------------
> > > > > > > > > > Post AmiQuote-related messages ONLY to:
> > > > > > > amiquote@xxxxxxxxxxxxxxx
> > > > > > > > > > (Web page:
> http://groups.yahoo.com/group/amiquote/messages/)
> > > > > > > > > > --------------------------------------------
> > > > > > > > > > Check group FAQ at:
> > > > > > > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > > > > > > > >
> > > > > > > > > > Your use of Yahoo! Groups is subject to
> > > > > > > http://docs.yahoo.com/info/terms/
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > > Send BUG REPORTS to bugs@xxxx
> > > > > > > > > Send SUGGESTIONS to suggest@xxxx
> > > > > > > > > -----------------------------------------
> > > > > > > > > Post AmiQuote-related messages ONLY to:
> amiquote@xxxxxxxxxxxxxxx
> > > > > > > > > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > > > > > > > > --------------------------------------------
> > > > > > > > > Check group FAQ at:
> > > > > > > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > > > > > > >
> > > > > > > > > Your use of Yahoo! Groups is subject to
> > > > > > > http://docs.yahoo.com/info/terms/
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > Send BUG REPORTS to bugs@xxxxxxxxxxxxx
> > > > > > > Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
> > > > > > > -----------------------------------------
> > > > > > > Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> > > > > > > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > > > > > > --------------------------------------------
> > > > > > > Check group FAQ at:
> > > > > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > > > > >
> > > > > > > Your use of Yahoo! Groups is subject to
> > > > > http://docs.yahoo.com/info/terms/
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > > Send BUG REPORTS to bugs@xxxxxxxxxxxxx
> > > > > > Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
> > > > > > -----------------------------------------
> > > > > > Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> > > > > > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > > > > > --------------------------------------------
> > > > > > Check group FAQ at:
> > > > > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > > > >
> > > > > > Your use of Yahoo! Groups is subject to
> > > http://docs.yahoo.com/info/terms/
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > Send BUG REPORTS to bugs@xxxxxxxxxxxxx
> > > > > Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
> > > > > -----------------------------------------
> > > > > Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> > > > > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > > > > --------------------------------------------
> > > > > Check group FAQ at:
> > > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > > >
> > > > > Your use of Yahoo! Groups is subject to
> > > http://docs.yahoo.com/info/terms/
> > > > >
> > > > >
> > > > >
> > > >
> > > > Send BUG REPORTS to bugs@xxxxxxxxxxxxx
> > > > Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
> > > > -----------------------------------------
> > > > Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> > > > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > > > --------------------------------------------
> > > > Check group FAQ at:
> > > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > >
> > > > Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > > Send BUG REPORTS to bugs@xxxxxxxxxxxxx
> > > Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
> > > -----------------------------------------
> > > Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> > > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > > --------------------------------------------
> > > Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > >
> > > Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
> > >
> > >
> > >
> >
> > Send BUG REPORTS to bugs@xxxxxxxxxxxxx
> > Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
> > -----------------------------------------
> > Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > --------------------------------------------
> > Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> >
> > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
> >
> >
> >
> 
> 
> Send BUG REPORTS to bugs@xxxxxxxxxxxxx
> Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
> -----------------------------------------
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> --------------------------------------------
> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> 
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
> 
> 
> 

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/