On Mon, Feb 23, 2009 at 09:03:54AM -0500, Hezekiah M. Carty wrote: > On Mon, Feb 23, 2009 at 5:04 AM, Andrew Ross > <[email protected]> wrote: > > > > Hez, > > > > Thanks for this. You've got me started thinking about something that has > > been on my todo list for a long time. Actually, it may not be as much > > work as I had assumed. It is not just plimage that has to worry about > > these issue - at least plline and plcont / plshade have problems too. > > plgriddata also doesn't handle nan's well. > > > > A couple of comments about your patch. > > > > 1) isnan / isinf are only defined in the C99 standard and so are not > > available for all compilers. We already have a test for isnan in place and > > provide a replacement. We would need to do something similar with isinf. > > > > 2) I'm not sure in principle whether a max / min function should exclude > > +/- inf values. These do behave correctly with respect to ordering, i.e. > > -inf < real / double number < inf. Of course from the point of view of > > plotting you want the finite max/min, which is perhaps a different thing. > > NaN's return false for any comparison and hence should be filtered out > > anyway by the test. > > > > Can you leave this with me for now and I'll try and integrate it along > > with further NaN / inf changes in the near future? > > > > Thanks > > > > Andrew > > Andrew, > > Thank you for the detailed reply. I'd be happy to leave the final > implementation with you on this and provide whatever testing or > assistance would be useful. Regarding your comments: > > 1) I thought that isnan and isinf were C99 standards, thank you for > clarifying this. An isinf replacement would be useful as infinite > values will wreck the automatic color scaling in plimage unless they > are either filtered or somehow handled explicitly.
I've tidied up the existing isnan support and added isinf as well. This needs testing, particularly on windows / other non-linux platforms. > 2) The plMinMax2dGrid function changes are there largely to go along > with my comment in (1) in its filtering of +/- infinity. But perhaps > a better method would be to provide an (internal) min/max function > which filters inf and nan values and either leave plMinMax2dGrid as is > or just update to filter nan values. At least plimage needs finite > limits to function properly. Regarding NaNs being filtered out in > plMinMax2dGrid - I'm not sure that they would if a NaN is the first > element in the array. The comparisons would then always return false > so the nan would filter through as both the minimum and maximum > values. I think you are correct that the NaN check in the inner for > loop could be removed. Thinking about it, I've decided to stick with your original idea. The main difference is that I've provided a replacement for HUGE_VAL if it is not defined. > The original patch is something I added to my local PLplot > installation because I have been repeatedly bitten by strange plot > results and/or segfaults related to NaNs and/or infinite values > slipping through to PLplot function calls. Again, I would be happy to > help in the testing or implementation of these updates. > > Thank you again for the comments. More to follow for other plplot functions when I get chance. Andrew ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Plplot-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/plplot-devel
