mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-15 06:44:10 +02:00
Scientific notation support
This commit is contained in:
parent
34c444767d
commit
1efdb334b4
2 changed files with 37 additions and 0 deletions
|
@ -175,6 +175,17 @@ namespace System
|
|||
{
|
||||
char8 c = val.Ptr[i];
|
||||
|
||||
//Exponent prefix used in scientific notation. E.g. 1.2E5
|
||||
if ((c == 'e') || (c == 'E'))
|
||||
{
|
||||
//Error if there are no numbers after the prefix
|
||||
if(i == val.Length - 1)
|
||||
return .Err;
|
||||
var exponent = Try!(int32.Parse(val.Substring(i + 1)));
|
||||
result *= Math.Pow(10, (double)exponent);
|
||||
break;
|
||||
}
|
||||
|
||||
if (c == '.')
|
||||
{
|
||||
if (decimalMultiplier != 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue