mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
Numeric ToString/Parse fixes
This commit is contained in:
parent
f1eca07510
commit
9ca48c26f2
4 changed files with 43 additions and 0 deletions
|
@ -174,6 +174,10 @@ namespace System
|
||||||
{
|
{
|
||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
|
else if ((c == '+') && (i == 0))
|
||||||
|
{
|
||||||
|
// Ignore
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return .Err(.InvalidChar(result));
|
return .Err(.InvalidChar(result));
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,6 +151,10 @@ namespace System
|
||||||
{
|
{
|
||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
|
else if ((c == '+') && (i == 0))
|
||||||
|
{
|
||||||
|
// Ignore
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return .Err(.InvalidChar(result));
|
return .Err(.InvalidChar(result));
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,6 +159,11 @@ namespace System
|
||||||
return (int64)(((uint64)InternalSample() << 32) | (uint64)InternalSample());
|
return (int64)(((uint64)InternalSample() << 32) | (uint64)InternalSample());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual uint64 NextU64()
|
||||||
|
{
|
||||||
|
return (((uint64)InternalSample() << 32) | (uint64)InternalSample());
|
||||||
|
}
|
||||||
|
|
||||||
private double GetSampleForLargeRange()
|
private double GetSampleForLargeRange()
|
||||||
{
|
{
|
||||||
// The distribution of double value returned by Sample
|
// The distribution of double value returned by Sample
|
||||||
|
|
|
@ -959,6 +959,21 @@ static int ToString(float d, char* outStr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ((len == 3) && (outStr[0] == 'i'))
|
||||||
|
{
|
||||||
|
strcpy(outStr, "Infinity");
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
if ((len == 4) && (outStr[0] == '-') && (outStr[1] == 'i'))
|
||||||
|
{
|
||||||
|
strcpy(outStr, "-Infinity");
|
||||||
|
return 9;
|
||||||
|
}
|
||||||
|
if ((len == 9) && (outStr[0] == '-') && (outStr[1] == 'n')) //-nan(xxx)
|
||||||
|
{
|
||||||
|
strcpy(outStr, "NaN");
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -993,6 +1008,21 @@ static int ToString(double d, char* outStr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ((len == 3) && (outStr[0] == 'i'))
|
||||||
|
{
|
||||||
|
strcpy(outStr, "Infinity");
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
if ((len == 4) && (outStr[0] == '-') && (outStr[1] == 'i'))
|
||||||
|
{
|
||||||
|
strcpy(outStr, "-Infinity");
|
||||||
|
return 9;
|
||||||
|
}
|
||||||
|
if ((len == 9) && (outStr[0] == '-') && (outStr[1] == 'n')) //-nan(xxx)
|
||||||
|
{
|
||||||
|
strcpy(outStr, "NaN");
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue