faheem801 / flot

Automatically exported from code.google.com/p/flot
MIT License
0 stars 0 forks source link

Handling asymptotes without failing #444

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Float is  failing in Handling asymptotes ( division by 0 is the cause ).
A good sample of handling asymptotes is: 
http://en.wikipedia.org/wiki/File:Hyperbola_one_over_x.svg

Original issue reported on code.google.com by rabaea.m...@gmail.com on 20 Dec 2010 at 10:38

GoogleCodeExporter commented 9 years ago
Flot can't draw functions? I guess if something is not working, then it's the 
code you're using to generate the asymptotes? Could you please elaborate?

Original comment by olau%iol...@gtempaccount.com on 21 Jan 2011 at 9:00

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
http://www.gleanequationgraph.org or 
http://www.fantastic-web-applications.com/ajax take it as example ....here i 
had to used  to a trick to avoid division by 0 .....but this is not the correct 
draw .
Try to graph  something like f(x)/g(x)using float .
imagine that you need to graph g(x)=(3x+7)/(2x-6) for x in interval (-5,5) and 
an 0.5 increment .
What do you think it happens when x=3 ???????? The graph explode ......float is 
unable to handle division by 0 because it's unable to emulate a virtual + 
infinite or -infinite    .
So it is not my code to blame ......is float ...unable to correct  draw an 
asymptote
I repeat correct way  of handling asymptotes is: 
http://en.wikipedia.org/wiki/File:Hyperbola_one_over_x.svg

Original comment by fantasti...@gmail.com on 8 Feb 2011 at 11:07

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r294.

Original comment by olau%iol...@gtempaccount.com on 10 Feb 2011 at 3:07

GoogleCodeExporter commented 9 years ago
Hi again!

Okay, if I understand you correctly, what's happening is that you feed 
infinity/-infinity into Flot. But Flot can't draw it if it's not a number, then 
the clipping code and the drawing code stops working.

So the easiest way out of this is simply replacing infinity with 
Number.MAX_VALUE and -infinity with -Number.MAX_VALUE. I can't see a good 
reason why we shouldn't support this replacement inside Flot, so I've modified 
the development version to do it. You can test it here:

http://flot.googlecode.com/svn/trunk/

It seems to do the right thing, as far as I can tell. Thanks for the report!

Original comment by olau%iol...@gtempaccount.com on 10 Feb 2011 at 3:10