Invalid floating point with Chartvalues as singles and Win32

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Marcel Horsthuis
Newbie
Newbie
Posts: 7
Joined: Tue May 10, 2016 12:00 am

Invalid floating point with Chartvalues as singles and Win32

Post by Marcel Horsthuis » Thu Dec 29, 2016 11:10 am

Hello,

Last Friday I bought the Pro version with source code so I could be able to use singles in the TChart values.
I changed the include file and recompiled the TChart source.

When I fill the series in a Win32 setting I get an Invalid Floating point error.
If I compile the same source as Win64 setting then every thing works fine.

I have made a test program that I attached .

I'm using Delphi 10.1 Berlin on a 64 Bit Pc.

Hope to hear from you soon.

Regards,

Marcel Horsthuis.
Attachments
Test_Chart32.zip
(249.23 KiB) Downloaded 626 times

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Invalid floating point with Chartvalues as singles and Win32

Post by Sandra » Thu Dec 29, 2016 3:10 pm

Hello Marcel,

Many thanks for the project and information.

We have reproduced the problem you're experiencing here. We're investigating the causes and we give you an answer as soon as possible.

Thanks in advance
Best Regards,
Sandra Pazos / 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

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

Re: Invalid floating point with Chartvalues as singles and Win32

Post by Yeray » Tue Jan 03, 2017 2:05 pm

Hello Marcel,

We've observed you are casting single to TChartValue here:

Code: Select all

      Chart_Test.Series[iSerie].XValues.Value    := TChartValues(F_XArray[iSerie]);
TChartValues is an array of TChartValue, and TChartValue is Double by default (or Single if you changed it in TeeDefs.inc). I'd suggest you to change your F_XArray and F_YArray intermediate variables to be array of array of TChartValue instead of array of array of single.

Code: Select all

    F_XArray : array of array of TChartValue;
    F_YArray : array of array of TChartValue;
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

Marcel Horsthuis
Newbie
Newbie
Posts: 7
Joined: Tue May 10, 2016 12:00 am

Re: Invalid floating point with Chartvalues as singles and Win32

Post by Marcel Horsthuis » Tue Jan 03, 2017 2:33 pm

Hello Yeray

I made the changes you suggested but the error still remains.

When debugging the code the error occurs in VLCTee.TeEngine.pas in function XPosValue.
It seems the the result value becomes greater then high(int32).

Regards,

Marcel

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

Re: Invalid floating point with Chartvalues as singles and Win32

Post by Yeray » Wed Jan 04, 2017 9:58 am

Hello Marcel,

Here my tests with RAD Studio 10.1 Berlin Update 2 in a Windows 10 x64, but always compiling against Win32 target platform:

- Using TEEVALUEDOUBLE (default) define in v2016.19 and defining F_XArray and F_YArray as array of array of single (as it is in your application):
Works fine for me here:
Test_Chart_2017-01-04_10-33-09.png
Test_Chart_2017-01-04_10-33-09.png (60.09 KiB) Viewed 13895 times
Changing F_XArray and F_YArray to array of array of TChartValue in your application gives the same result.

- Using TEEVALUESINGLE define in v2016.19 and defining F_XArray and F_YArray as array of array of single (as it is in your application):
Doesn't crash, but gives me a strange result:
Test_Chart_2017-01-04_10-39-26.png
Test_Chart_2017-01-04_10-39-26.png (25.54 KiB) Viewed 13894 times
Changing F_XArray and F_YArray to array of array of TChartValue in your application gives the same result.

- Using TEEVALUEEXTENDED define in v2016.19 TeeRecompile crashes with an error in TChartAxis.IncDec method. We've corrected this error for the next maintenance release.
I'll send the latest sources to the mail account you have registered in this forums.

- Using TEEVALUEEXTENDED define with the current sources and defining F_XArray and F_YArray as array of array of single (as it is in your application):
Crashes at the TChartValueList.RecalcStats method in VCLTee.TeEngine.pas.

Changing F_XArray and F_YArray to array of array of TChartValue in your application works fine for me here, giving a different result than the result obtained using TEEVALUEDOUBLE above:
Test_Chart_2017-01-04_10-53-30.png
Test_Chart_2017-01-04_10-53-30.png (80.14 KiB) Viewed 13893 times
Could you please explain what result would you expect to obtain?
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

Marcel Horsthuis
Newbie
Newbie
Posts: 7
Joined: Tue May 10, 2016 12:00 am

Re: Invalid floating point with Chartvalues as singles and Win32

Post by Marcel Horsthuis » Wed Jan 04, 2017 10:28 am

Hello Yeray

Thank you for your solution.
The last graph is the graph is the result we expect to obtain.

The first graph is the result if you assign a doubles array to a singles ChartValues in lines 104 and 108 of the program

Code: Select all

 
104      Chart_Test.Series[iSerie].XValues.Value    := TChartValues(F_XArray[iSerie]);
105      Chart_Test.Series[iSerie].XValues.Modified := True;
106     Chart_Test.Series[iSerie].XValues.Count    := ValueCount;
107
108      Chart_Test.Series[iSerie].YValues.Value    := TChartValues(F_YArray[iSerie]);
109      Chart_Test.Series[iSerie].YValues.Modified := True;
110      Chart_Test.Series[iSerie].YValues.Count    := ValueCount;
This is intended to point the X/YValues.Value array of the series to the pointer of the 2 dimensional array by iSerie
So if you have Singles array values pointing to double Chart values then you get a mismatch of points resulting in graph 1.

The graph 2 gives the same result as on my pc. The error occurs if I resize the form.

I'm excited to receive your mail with the solution.

Thank you for your quick support. (working on a deadline right now)

Marcel Horsthuis

Marcel Horsthuis
Newbie
Newbie
Posts: 7
Joined: Tue May 10, 2016 12:00 am

Re: Invalid floating point with Chartvalues as singles and Win32

Post by Marcel Horsthuis » Wed Jan 04, 2017 3:31 pm

Thank you Yeray for the beta version.

After un-installing the previous version and installing the beta version my test program works fine.

I had some problems compiling the actual program but after changing all the TeeDef.inc files for single TChartValues in the win32 directories the actual program works now also.

Thank you again for the support.

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

Re: Invalid floating point with Chartvalues as singles and Win32

Post by Yeray » Thu Jan 05, 2017 7:45 am

Hello,

Great, thanks for the feedback!
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

Post Reply