numbers in scarpet better handle long type values.
If possible, numbers that can be represented as longs (seeds, etc) will be handled as longs but they will loose their longinness with a single arithmetic operation.
This commit is contained in:
1 parent
bc9f3e89e0
commit
968ef0cd9f
8 files changed
+87
-24
No files matched your search
@@ -1546,11 +1546,17 @@ public class Expression
|
||||
});
|
||||
addUnaryFunction("number", v -> {
|
||||
if (v instanceof NumericValue)
|
||||
{
|
||||
return v;
|
||||
double res = v.readNumber();
|
||||
if (Double.isNaN(res))
|
||||
}
|
||||
try
|
||||
{
|
||||
return new NumericValue(v.getString());
|
||||
}
|
||||
catch (NumberFormatException format)
|
||||
{
|
||||
return Value.NULL;
|
||||
return new NumericValue(v.readNumber());
|
||||
}
|
||||
});
|
||||
addFunction("str", lv ->
|
||||
{
|
||||
@@ -1593,7 +1599,7 @@ public class Expression
|
||||
{
|
||||
if (argIndex >= lv.size())
|
||||
throw new InternalExpressionException("Not enough arguments for "+m.group(0));
|
||||
args.add(lv.get(argIndex).readNumber());
|
||||
args.add(lv.get(argIndex).readDoubleNumber());
|
||||
argIndex++;
|
||||
}
|
||||
else if (fmt == 'b')
|
||||
|
||||
Reference in new issue
Block a user