bugGNU Octave - Bugs: bug #40246, OpenGL should test data and abort...

 
 

bug #40246: OpenGL should test data and abort plot if range > float range

Submitter:  Rik <rik5>
Submitted:  Fri 11 Oct 2013 05:31:07 PM UTC
   
 
Category:  Plotting with OpenGL Severity:  4 - Important
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 23 Oct 2013 05:07:05 PM UTC, comment #12: 

I thought about it, but I don't think it is as efficient to call out to abs().  Also, the reduced test wouldn't catch this case


xdata = -realmax ("single") + (-5:5)


In this case, abs (x_max) would be less than realmax, but x_min would exceed realmax.

Rik <rik5>
Group administrator
Wed 23 Oct 2013 04:33:09 PM UTC, comment #11: 

Just as a remark, instead of:
if (x_max > floatmax || y_max > floatmax || z_max > floatmax)
 || (x-min < -floatmax || ... and so on ... )

the following is shorter, but maybe not quite as efficient?

if (abs(x_max) > floatmax || abs(y_max) > floatmax
   || abs(z_max) > floatmax)

Sorry I did not say this before.

Michael Godfrey <godfrey>
Group Member
Wed 23 Oct 2013 12:42:34 AM UTC, comment #10: 

I get it.  A pain.  The only thing I could think of
is to include "previous_{x,y,z} in the structure that
provides the x-min, etc. Or, maybe allow turning off
the warning for each plot after it is first issued.
Unconditionally take the return though so invalid data
are not plotted.

Or, just learn to live with it.  Should not happen that
often, and you have more serious problems to work on.

Michael Godfrey <godfrey>
Group Member
Tue 22 Oct 2013 11:26:21 PM UTC, comment #9: 

I pushed a changeset for min values smaller than -maxfloat (http://hg.savannah.gnu.org/hgweb/octave/rev/dcc88366f94b).

Rik <rik5>
Group administrator
Tue 22 Oct 2013 11:09:03 PM UTC, comment #8: 

I know about the multiple warnings, but there isn't much of a way to fix it.  In short, better to follow the warning's advice and either scale the data or switch to gnuplot.

Stopping the redraw events isn't going to happen for FLTK.  It's a lot of pain to figure out how it might be worked out and we're leaving this widget kit behind in favor of Qt anyways.  When we switch to Qt I'm sure we'll have a host of new problems, but that is where we would like to actually create a fix.

As for stopping the warning, that's not so easy either.  You would need some sort of persistent storage on a per axis basis.  Yes, the graphics properties contain the X,Y,Z data on a per-axis basis, but they are in the general code of graphics.cc which is written for any backend.  We don't want to pollute it with a lot of tests for this or that toolkit.  Instead, it should be the toolkit itself which handles things.  That's how it is now; Only the gl-renderer issues a warning because it is the only backend that cares whether float or double is used.

Rik <rik5>
Group administrator
Tue 22 Oct 2013 10:17:20 PM UTC, comment #7: 

Sorry to report another slight fix needed.
For
if (x_max > floatmax || y_max > floatmax || z_max > floatmax)

maybe:

if (x_max > floatmax || y_max > floatmax || z_max > floatmax) ||
   (x-min < -floatmax ||  ...  and so on ...  )

Michael Godfrey <godfrey>
Group Member
Tue 22 Oct 2013 09:17:44 PM UTC, comment #6: 

Not quite fine. The warning message repeats
every time thew mouse moves over the plot.
This is observed by:
plot (1:200)
plot([0 10^44])

then move mouse over the plot.

A choice:
1. Fix the redraw on mouse movement.
2. Fix the warning to only happen once.

It could be as hard to do 1. as 2. !!

Is there no easy way, at the top of gl-render.cc,
to determine if the plot has been modified since
the last redraw?

I originally posted this to the wrong bug (#39925) Sorry.

Michael Godfrey <godfrey>
Group Member
Tue 22 Oct 2013 06:52:24 PM UTC, comment #5: 

I checked in a changeset here (http://hg.savannah.gnu.org/hgweb/octave/rev/d449f4668b72).  This only tests if the data ranges are bigger than the maximum float.  It does not test for a loss of precision.

Rik <rik5>
Group administrator
Tue 22 Oct 2013 06:16:26 PM UTC, comment #4: 

I think I have a reasonable place for this, and it does work to stop plotting, but it produces a lot of scary looking error messages on the screen.

Unfortunately, it doesn't solve the other issue with images.  So, I'll continue to tackle this one, but the imagesc bug will need a different fix.  I'll post back on the other report about that.

Rik <rik5>
Group administrator
Tue 22 Oct 2013 04:46:08 PM UTC, comment #3: 

Rik which file do you want to put this FIX in?

Doug Stewart <dastew>
Fri 11 Oct 2013 10:37:41 PM UTC, comment #2: 

The tolerance should be an adjustable feature so we can tune it.

The problem for bug #33748 is not that realmax is exceeded but that the precision is exceeded (only ~7 digits for single).  So, this might be something else to test for.  In a quick and dirty test,


xmean = mean (x);
deltas = x .- xmean;
bad = any (deltas < eps (xmean));


But that would probably need some improving.

Rik <rik5>
Group administrator
Fri 11 Oct 2013 08:13:00 PM UTC, comment #1: 

Note that in my original bug report (bug #33748) I included a picture where the horizontal scale referred to Octave datenums (order 733000); realmax ("single") is much larger (3.4028e38).

Apparently FLTK's limits are much much lower.

Philip Nienhuis <philipnienhuis>
Group Member
Fri 11 Oct 2013 05:31:07 PM UTC, original submission:  

The FLTK/OpenGL plotting engine uses float values to represent data.  Anything plotted with values exceeding realmax ("single") cause strangely distorted plots or no plots at all.  Also, it is the range that is important, rather than the individual data itself.  Plotting from [-1e20, +1e20] will also cause a problem.  For log axes, of course, this restriction is lifted.

For the 3.8 release we need to add a bit of code to test the data and abort the plot if it won't plot correctly.  The warning message should mention two solutions, 1) scaling the data or 2) reverting to gnuplot.

Rik <rik5>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by godfrey (Posted a comment)
  • -email is unavailable- added by dastew (Posted a comment)
  • -email is unavailable- added by rik5 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-10-22 rik5 Open/ClosedOpen Closed
    2013-10-22 rik5 StatusNone Fixed

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code