Large numbers (Invalid floating point operation)

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
JES
Newbie
Newbie
Posts: 5
Joined: Wed Jan 30, 2008 12:00 am

Large numbers (Invalid floating point operation)

Post by JES » Sun Feb 15, 2009 1:19 pm

In version 8.04 when adding large number(s) I get "Invalid floating point operation" -error when chart refresh (draws itself).

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
   DBChart1.Series[0].addxy(0,9.58737850189209);
   DBChart1.Series[0].addxy(1,3.40282346638529E+38);
   DBChart1.Series[0].addxy(2,10.2478742599487);
end;
Is it a bug or is there another way to add large numbers?

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Mon Feb 16, 2009 10:32 am

Hi JES,

Yes, having a distance so big in values it causes an error. But I've solved the problem and it will be ready for next maintenance release.

I've seen that you are a source code customer so, if you want, you could implement the change to fix it before than the next maintenance release will be available. You simply should edit your TeEngine.pas and change one line at the beginning of the CalcIncrement function. You should have:

Code: Select all

Function TChartAxis.CalcIncrement:Double;
var tmp    : Integer;
    tmpMin : Double;
    tmpMax : Double;
    tmpMid : Double;
    tmp2   : Integer;
begin
  if RoundFirstLabel and (Increment<>0) then
  begin
    tmpMin:=Increment*Round(IMinimum);
    tmpMax:=Increment*Trunc(IMaximum);
  end
  else
//...
You should change it for:

Code: Select all

Function TChartAxis.CalcIncrement:Double;
var tmp    : Integer;
    tmpMin : Double;
    tmpMax : Double;
    tmpMid : Double;
    tmp2   : Integer;
begin
  if RoundFirstLabel and (Increment<>0) then
  begin
    tmpMin:=Increment*Round(IMinimum);
    tmpMax:=Increment*Int(IMaximum);
  end
  else
//...
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

JES
Newbie
Newbie
Posts: 5
Joined: Wed Jan 30, 2008 12:00 am

Post by JES » Mon Feb 16, 2009 11:01 am

ok!

Thanks,
JES

Post Reply