diff --git a/Operand.cpp b/Operand.cpp index af8bee7..671a345 100644 --- a/Operand.cpp +++ b/Operand.cpp @@ -328,9 +328,27 @@ namespace jet { } else throw coreutils::Exception("Expecting ) at end of TRUNC expression."); } 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")) { - + 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")) { if(!in.ifNext("(")) throw coreutils::Exception("Expecting ( for UNIXTIME.");