LazStats: Accept both decimal separators in the sub-menu forms of "Simulations" > "Probabilities"

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8048 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2021-06-04 09:59:27 +00:00
parent a7913ef0a4
commit 2004440204
16 changed files with 283 additions and 209 deletions

View File

@ -46,6 +46,7 @@ function FactorialLn(n: Integer): Double;
function PoissonPDF(n: integer; a: double): Double;
function PoissonCDF(n: Integer; a: double): Double;
function MyTryStrToFloat(S: String; out AValue: Double): Boolean;
implementation
@ -569,6 +570,20 @@ begin
end;
{ Converts a string to a floating point value. Checks for comma or point as
decimal separator }
function MyTryStrToFloat(S: String; out AValue: Double): Boolean;
var
fs: TFormatSettings;
begin
Result := TryStrToFloat(S, AValue);
if not Result then
begin
fs := FormatSettings;
if fs.DecimalSeparator = '.' then fs.DecimalSeparator := ',' else fs.DecimalSeparator := '.';
Result := TryStrToFloat(S, AValue, fs);
end;
end;
initialization
InitFactLn();