From 1064b69d04aed5e5bb95ce5670a2def8b6d30c6a Mon Sep 17 00:00:00 2001 From: Ratstail91 Date: Sun, 26 Feb 2023 01:27:21 +1100 Subject: [PATCH] BUGFIX: Integer and float comparisons always return true --- source/toy_common.h | 4 ++-- source/toy_literal.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/toy_common.h b/source/toy_common.h index 67c52e4..88b2f08 100644 --- a/source/toy_common.h +++ b/source/toy_common.h @@ -5,8 +5,8 @@ #include #define TOY_VERSION_MAJOR 1 -#define TOY_VERSION_MINOR 0 -#define TOY_VERSION_PATCH 1 +#define TOY_VERSION_MINOR 1 +#define TOY_VERSION_PATCH 0 #define TOY_VERSION_BUILD __DATE__ " " __TIME__ //platform/compiler-specific instructions diff --git a/source/toy_literal.c b/source/toy_literal.c index abf17e7..28a7d67 100644 --- a/source/toy_literal.c +++ b/source/toy_literal.c @@ -241,10 +241,10 @@ bool Toy_literalsAreEqual(Toy_Literal lhs, Toy_Literal rhs) { // ints and floats are compatible if ((TOY_IS_INTEGER(lhs) || TOY_IS_FLOAT(lhs)) && (TOY_IS_INTEGER(rhs) || TOY_IS_FLOAT(rhs))) { if (TOY_IS_INTEGER(lhs)) { - return TOY_AS_INTEGER(lhs) + TOY_AS_FLOAT(rhs); + return TOY_AS_INTEGER(lhs) == TOY_AS_FLOAT(rhs); } else { - return TOY_AS_FLOAT(lhs) + TOY_AS_INTEGER(rhs); + return TOY_AS_FLOAT(lhs) == TOY_AS_INTEGER(rhs); } }