Skip to content

Commit

Permalink
Different approach to recognizing reals
Browse files Browse the repository at this point in the history
  • Loading branch information
atomb committed Apr 5, 2024
1 parent e2a462c commit 01ca761
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Source/Model/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,6 @@ Element ConstructElement(string name)
}

var allDigits = new Regex(@"^-?[0-9]*$");
var real = new Regex(@"^-?[0-9]+((\.[0-9]+)|((\.[0-9]+)?(e[0-9]+)))$");
if (allDigits.IsMatch(name))
{
if (szi > 0)
Expand All @@ -711,7 +710,7 @@ Element ConstructElement(string name)
return new Integer(this, name);
}
}
else if (real.IsMatch(name))
else if (double.TryParse(name, out var _))
{
return new Real(this, name);
}
Expand Down Expand Up @@ -1077,4 +1076,4 @@ public static List<Model> ParseModels(System.IO.TextReader rd, Func<string, stri
return p.resModels;
}
}
}
}

0 comments on commit 01ca761

Please sign in to comment.