From e6a5f9860654f417256e038711f0d5624467a189 Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Thu, 20 Oct 2022 21:54:40 +0200 Subject: [PATCH] float.min will now give -float.max --- src/compiler/compiler_internal.h | 1 - src/compiler/sema_expr.c | 8 ++++---- src/compiler/symtab.c | 1 - test/test_suite/expressions/type_support.c3t | 6 ++++-- test/test_suite2/expressions/type_support.c3t | 5 +++-- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/compiler/compiler_internal.h b/src/compiler/compiler_internal.h index 40fe4c0d7..c25f2ab07 100644 --- a/src/compiler/compiler_internal.h +++ b/src/compiler/compiler_internal.h @@ -1821,7 +1821,6 @@ extern const char *kw_std__core; extern const char *kw_std__core__types; extern const char *kw_typekind; -extern const char *kw_align; extern const char *kw_argc; extern const char *kw_argv; extern const char *kw_at_checked; diff --git a/src/compiler/sema_expr.c b/src/compiler/sema_expr.c index 75a6f6cc5..edf51b299 100644 --- a/src/compiler/sema_expr.c +++ b/src/compiler/sema_expr.c @@ -2947,17 +2947,17 @@ static inline bool sema_create_const_min(SemaContext *context, Expr *expr, Type switch (flat->type_kind) { case TYPE_F16: - expr->const_expr.fxx.f = 5.9604645e-8; + expr->const_expr.fxx.f = -65504.0; break; case TYPE_F32: - expr->const_expr.fxx.f = FLT_MIN; + expr->const_expr.fxx.f = -FLT_MAX; break; case TYPE_F64: - expr->const_expr.fxx.f = DBL_MIN; + expr->const_expr.fxx.f = -DBL_MAX; break; case TYPE_F128: REMINDER("Float 128 not complete"); - expr->const_expr.fxx.f = DBL_MIN; + expr->const_expr.fxx.f = -DBL_MAX; break; default: UNREACHABLE; diff --git a/src/compiler/symtab.c b/src/compiler/symtab.c index 5aa96f12c..9fddd13f5 100644 --- a/src/compiler/symtab.c +++ b/src/compiler/symtab.c @@ -133,7 +133,6 @@ void symtab_init(uint32_t capacity) kw_typekind = KW_DEF("TypeKind"); type = TOKEN_IDENT; - kw_align = KW_DEF("align"); kw_argc = KW_DEF("_$argc"); kw_argv = KW_DEF("_$argv"); kw_check_assign = KW_DEF("check_assign"); diff --git a/test/test_suite/expressions/type_support.c3t b/test/test_suite/expressions/type_support.c3t index 61d8a92ac..1002721e4 100644 --- a/test/test_suite/expressions/type_support.c3t +++ b/test/test_suite/expressions/type_support.c3t @@ -25,6 +25,8 @@ fn void main() /* #expect: test.ll + + store i64 0 store i64 1 store i8 0 store i8 -1 @@ -68,8 +70,8 @@ fn void main() store i64 -9223372036854775808 store i64 9223372036854775807 store i64 4 - store float 0x3810000000000000 + store float 0xC7EFFFFFE0000000 store float 0x47EFFFFFE0000000 store i64 8 - store double 0x10000000000000 + store double 0xFFEFFFFFFFFFFFFF store double 0x7FEFFFFFFFFFFFFF \ No newline at end of file diff --git a/test/test_suite2/expressions/type_support.c3t b/test/test_suite2/expressions/type_support.c3t index 61d8a92ac..29ae694f5 100644 --- a/test/test_suite2/expressions/type_support.c3t +++ b/test/test_suite2/expressions/type_support.c3t @@ -25,6 +25,7 @@ fn void main() /* #expect: test.ll + store i64 0 store i64 1 store i8 0 store i8 -1 @@ -68,8 +69,8 @@ fn void main() store i64 -9223372036854775808 store i64 9223372036854775807 store i64 4 - store float 0x3810000000000000 + store float 0xC7EFFFFFE0000000 store float 0x47EFFFFFE0000000 store i64 8 - store double 0x10000000000000 + store double 0xFFEFFFFFFFFFFFFF store double 0x7FEFFFFFFFFFFFFF \ No newline at end of file