getMaximumDomainValue error

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Menno

getMaximumDomainValue error

Post by Menno » Tue Feb 20, 2001 1:51 pm

I came across what I think is an error in the getMaximumDomainValue member of the Datasources class.

A problem arises because of the following line:

double maximum = Double.MIN_VALUE;

Double.MIN_VALUE is the smallest possible POSITIVE double. So if you have all negative numbers ( For example in my case it was with dates in the year 1920, which are negative ), then the max value returned is always Double.MIN_VALUE, which is incorrect.

Let me know if you need a clearer explanation.

Cheers,
Menno

David Gilbert

RE: getMaximumDomainValue error

Post by David Gilbert » Wed Feb 21, 2001 8:58 pm

Oops! Thanks for spotting this - I hadn't even realised that MIN_VALUE worked like that.

As a solution I tried changing MIN_VALUE to NEGATIVE_INFINITY and that seemed to work. But as I've never really studied the Number classes that closely (obviously!) I'm not sure if that introduces any other problems. Let me know if you know more...

Regards,

DG.

P.S. I registered this as a bug on SourceForge (id = 133446).

Locked