fixed output of numeric output from expr().

This commit is contained in:
Brad Arant 2025-12-02 15:56:31 -08:00
parent 3f14b28435
commit db59e9e87c
4 changed files with 8 additions and 6 deletions

View File

@ -64,6 +64,11 @@ namespace jet {
Operand op(parm1.string, tag);
string = op.string;
isNumber = op.isNumber;
if(isNumber) {
doubleValue = op.doubleValue;
string = std::format("{:.12f}", doubleValue);
string.removeTrailingZeros();
}
boolean = op.boolean;
} else
throw coreutils::Exception("Expecting ) at end of EXPR expression.");

View File

@ -1,5 +0,0 @@
#!../jet-2.0
<jet name1="localname" filterblanklines="true" trimlines="true">
<set name="result" expr="2 + 2 * 3 + 2" />
$[result]=10
</jet>

View File

@ -1,6 +1,6 @@
#!../jet-2.0
<jet cgi="true" name1="localname" filterblanklines="true" trimlines="true">
<mysql host="localhost" database="barant" user="barant" password="uversa" sessionid="1">
<mysql host="barant.com" database="barant" user="barant" password="uversa" sessionid="1">
<sql sessionid="1">select * from testdata</sql>
<whilerow name="index" count="10" sessionid="1">
$[1.id] $[1.text] $[1.value]

View File

@ -23,4 +23,6 @@ $[result]=45
$[result]=45
<set name="result" expr="2 + 2 * 3 + 2" />
$[result]=10
<set name="result" expr="expr(2 + 2 * 3 + 2)" />
$[result]=10
</jet>