Heavy work on while tag. Still needs work.

This commit is contained in:
Brad Arant committed 2024-11-04 16:48:14 -08:00
1 parent b08d2b59eb
commit ed00a330a4
5 files changed
+46 -25

No files matched your search

+12 -6
View File
@@ -70,7 +70,8 @@ namespace jet {
unsigned int seed = (unsigned int)clock();
doubleValue = (double) rand_r(&seed) / (RAND_MAX + 1.0);
isNumber = true;
string = std::format("{}", doubleValue);
string = std::format("{:.12f}", doubleValue);
string.removeTrailingZeros();
} else if(in.ifNext("true")) {
boolean = true;
string = "true";
@@ -79,7 +80,7 @@ namespace jet {
string = "false";
} else if(in.startsWithNumber()) {
doubleValue = in.asDouble();
string = std::format("{}", doubleValue);
string = std::format("{:.12f}", doubleValue);
isNumber = true;
} else if(in.ifNext("'")) {
string = in.getTokenExclude("'");
@@ -116,6 +117,7 @@ namespace jet {
if(in.ifNext("<")) {
Operand op(in);
if(isNumber && op.isNumber) {
std::cout << doubleValue << " < " << op.doubleValue << std::endl;
if(doubleValue < op.doubleValue) {
boolean = true;
isNumber = false;
@@ -238,7 +240,8 @@ namespace jet {
Operand op(in);
if(op.isNumber) {
doubleValue += op.doubleValue;
string = std::format("{}", doubleValue);
string = std::format("{:.12f}", doubleValue);
string.removeTrailingZeros();
} else
throw coreutils::Exception("operand is not a number.");
} else
@@ -248,7 +251,8 @@ namespace jet {
Operand op(in);
if(op.isNumber) {
doubleValue -= op.doubleValue;
string = std::format("{}", doubleValue);
string = std::format("{:.12f}", doubleValue);
string.removeTrailingZeros();
} else
throw coreutils::Exception("operand is not a number.");
} else
@@ -258,7 +262,8 @@ namespace jet {
Operand op(in);
if(op.isNumber) {
doubleValue *= op.doubleValue;
string = std::format("{}", doubleValue);
string = std::format("{:.12f}", doubleValue);
string.removeTrailingZeros();
} else
throw coreutils::Exception("operand is not a number.");
} else
@@ -268,7 +273,8 @@ namespace jet {
Operand op(in);
if(op.isNumber) {
doubleValue /= op.doubleValue;
string = std::format("{}", doubleValue);
string = std::format("{:.12f}", doubleValue);
string.removeTrailingZeros();
} else
throw coreutils::Exception("operand is not a number.");
} else