Page 1 of 1

Large numbers (Invalid floating point operation)

Posted: Sun Feb 15, 2009 1:19 pm
by 10548168
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?

Posted: Mon Feb 16, 2009 10:32 am
by yeray
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
//...

Posted: Mon Feb 16, 2009 11:01 am
by 10548168
ok!

Thanks,
JES