Value overflow in TChartAxis.CalcIncrement

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
bertrod
Advanced
Posts: 151
Joined: Wed Sep 07, 2005 4:00 am

Value overflow in TChartAxis.CalcIncrement

Post by bertrod » Tue Sep 02, 2008 8:56 am

Hello,

I have a problem with a new portion of code in TeEngine.pas : TChartAxis.CalcIncrement().

Code: Select all

tmpMin:=Increment*Round(IMinimum);
We have very high values, like 1e24, and if you make :

increment * iminimum
i.e. 1e20 * 1e24 => the Double range is overflowed


For the moment, we removed this calculation and put back the old version we had and which works :

Code: Select all

tmpMid:=(IMinimum+IMaximum)*0.5;

What about using Extended, would it be possible ?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Sep 02, 2008 9:22 am

Hi bertrod,

Thanks for reporting. I've added your request to the wish-list to be considered for inclusion in next releases.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Sep 03, 2008 9:29 am

Hi bertrod,

As an update, we think the problem is in the Round method which crashes even using Extended with "large" values, for example:

Code: Select all

var tmp : Extended;
  tmp:=1e18;
  tmp:=Round(tmp);   // <--- OK

  tmp:=1e1800001;
  tmp:=Round(tmp);   // <--- floating point overflow exception
In that case, the solution is not changing to Extended nor changing the code to how it was before because customers who are happy with this would complain.

To avoid this exception, a solution could be setting RoundFirstLabel := False so that code doesn't use Round method.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply