Greetings.

Attached is a patch to fix the assert bug Joseph VanAndel identified when using 
LogScale.

The assert failed because the minimum value in the data was less than the 
automatic padding.  That results in a negative minimum value, which can't be 
represented in LogScale.  The patch changes the automatic behavior to operate 
on exponents when padding the extrema in LogScale, instead of the values 
themselves.  This lets large and small values be handled fairly and safely.

-- 
Joe Garcia
Instrumentation Technologist
UW Lidar Group
University of Wisconsin - Madison

Attachment: WAxis_LogScale_out_of_bounds.patch
Description: Binary data

On Aug 22, 2011, at 3:57 PM, Joseph VanAndel wrote:

> Using Wt 3.1.10, in WAxis::computeRange() 
> 
> The
> assert(segment.renderMinimum < segment.renderMaximum)
> fails when plotting a YAxis with a log scale, if the input data is two values 
> of ".0001"
> 
> The values of segment when the assertion fails are:
> print segment
> $15 = (const Wt::Chart::WAxis::Segment &) @0x10480b430: {
>  minimum = -1.7976931348623157e+308, 
>  maximum = 1.7976931348623157e+308, 
>  renderMinimum = -nan(0x8000000000000), 
>  renderMaximum = 1, 
>  renderLength = 310, 
>  renderStart = 355
> 
> Tracing through the method, at WAxis.C:511: 
> 
> segment.renderMinimum = -0.099900000000000003, 
> double minLog10 = std::floor(std::log10(segment.renderMinimum));
> print minLog10
> $13 = -nan(0x8000000000000)
> 
> segment.renderMinimum = std::pow(10, (minLog10));  // computing with a Nan 
> yields a Nan.
> 
> 
> I've attached the source code for the program that reveals this bug.  
> 
> Make a symbolic link to the resources directory, 
> Run the program, ../../build/examples/charts.stress/*.wt --docroot . 
> --http-address 0.0.0.0 --http-port 8080
> 
> To trigger the bug: deselect the two graphs on top, select 'SPCOMP', and the 
> application crashes with 
> 
> assert(segment.renderMinimum < segment.renderMaximum), WAxis.C:548
> 
> <charts.stress.tgz>
> 
> 
> 

------------------------------------------------------------------------------
Malware Security Report: Protecting Your Business, Customers, and the 
Bottom Line. Protect your business and customers by understanding the 
threat from malware and how it can impact your online business. 
http://www.accelacomm.com/jaw/sfnl/114/51427462/
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to