Added FLOOR and CEIL function in operand.
This commit is contained in:
parent
5e0523619d
commit
63916cc32a
22
Operand.cpp
22
Operand.cpp
@ -328,9 +328,27 @@ namespace jet {
|
|||||||
} else
|
} else
|
||||||
throw coreutils::Exception("Expecting ) at end of TRUNC expression.");
|
throw coreutils::Exception("Expecting ) at end of TRUNC expression.");
|
||||||
} else if(in.ifNextIgnoreCase("CEIL")) {
|
} else if(in.ifNextIgnoreCase("CEIL")) {
|
||||||
|
if(!in.ifNext("("))
|
||||||
|
throw coreutils::Exception("Expecting ( for CEIL parameters.");
|
||||||
|
Operand parm1(in, tag);
|
||||||
|
if(in.ifNext(")")) {
|
||||||
|
doubleValue = ceil(parm1.doubleValue);
|
||||||
|
isNumber = true;
|
||||||
|
string = std::format("{:.12f}", doubleValue);
|
||||||
|
string.removeTrailingZeros();
|
||||||
|
} else
|
||||||
|
throw coreutils::Exception("Expecting ) at end of CEIL expression.");
|
||||||
} else if(in.ifNextIgnoreCase("FLOOR")) {
|
} else if(in.ifNextIgnoreCase("FLOOR")) {
|
||||||
|
if(!in.ifNext("("))
|
||||||
|
throw coreutils::Exception("Expecting ( for FLOOR parameters.");
|
||||||
|
Operand parm1(in, tag);
|
||||||
|
if(in.ifNext(")")) {
|
||||||
|
doubleValue = floor(parm1.doubleValue);
|
||||||
|
isNumber = true;
|
||||||
|
string = std::format("{:.12f}", doubleValue);
|
||||||
|
string.removeTrailingZeros();
|
||||||
|
} else
|
||||||
|
throw coreutils::Exception("Expecting ) at end of FLOOR expression.");
|
||||||
} else if(in.ifNextIgnoreCase("UNIXTIME")) {
|
} else if(in.ifNextIgnoreCase("UNIXTIME")) {
|
||||||
if(!in.ifNext("("))
|
if(!in.ifNext("("))
|
||||||
throw coreutils::Exception("Expecting ( for UNIXTIME.");
|
throw coreutils::Exception("Expecting ( for UNIXTIME.");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user