Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / Table.cpp
diff options
context:
space:
mode:
Commitcd40b3479f8ce874cc69663b7318dc9f033ed1f1 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-05-29 10:14:27 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-05-29 10:14:27 +0300
Files343fa572cdf20e4d861c90eb6c53178348de3045 /src/Models/Table.cpp
FMI-OOP-P2_Tables-cd40b3479f8ce874cc69663b7318dc9f033ed1f1.tar
FMI-OOP-P2_Tables-cd40b3479f8ce874cc69663b7318dc9f033ed1f1.tar.gz
FMI-OOP-P2_Tables-cd40b3479f8ce874cc69663b7318dc9f033ed1f1.zip
Parenta1ebb727ac98a291a944562f7be17e3645f5315a (diff)
Autocommit at 29.05.2022 @ 10:14
1 files changed, 3 insertions, 1 deletions
-rw-r--r--src/Models/Table.cpp4
diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp
index 7e4a7ac..ce902f9 100644
--- a/src/Models/Table.cpp
+++ b/src/Models/Table.cpp
@@ -24,6 +24,8 @@ bool containsNumber(const char*& str) {
(*str >= '0' && *str <= '9'); // + or -, followed by digit, or it just a digit
}
+#define abs(a) ((a < 0) ? -a : a)
+
void Table::putCell(unsigned row, unsigned col, const char* rawValue) {
Cell* newCell;
@@ -31,7 +33,7 @@ void Table::putCell(unsigned row, unsigned col, const char* rawValue) {
double intParse = atoi(rawValue);
double doubleParse = atof(rawValue);
- newCell = (doubleParse - intParse > 0.00001 && doubleParse > 0.00001)
+ newCell = (abs(doubleParse) - abs(intParse) > 0.00001)
? (Cell*)new CellDouble(doubleParse) : (Cell*)new CellInt(intParse);
}
else {