Page 1 of 1
Invalid floating point with Chartvalues as singles and Win32
Posted: Thu Dec 29, 2016 11:10 am
by 16478246
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.
Re: Invalid floating point with Chartvalues as singles and Win32
Posted: Thu Dec 29, 2016 3:10 pm
by 10050769
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
Re: Invalid floating point with Chartvalues as singles and Win32
Posted: Tue Jan 03, 2017 2:05 pm
by yeray
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;
Re: Invalid floating point with Chartvalues as singles and Win32
Posted: Tue Jan 03, 2017 2:33 pm
by 16478246
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
Re: Invalid floating point with Chartvalues as singles and Win32
Posted: Wed Jan 04, 2017 9:58 am
by yeray
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 (60.09 KiB) Viewed 14722 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 (25.54 KiB) Viewed 14721 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 (80.14 KiB) Viewed 14720 times
Could you please explain what result would you expect to obtain?
Re: Invalid floating point with Chartvalues as singles and Win32
Posted: Wed Jan 04, 2017 10:28 am
by 16478246
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
Re: Invalid floating point with Chartvalues as singles and Win32
Posted: Wed Jan 04, 2017 3:31 pm
by 16478246
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.
Re: Invalid floating point with Chartvalues as singles and Win32
Posted: Thu Jan 05, 2017 7:45 am
by yeray
Hello,
Great, thanks for the feedback!