float.min will now give -float.max

This commit is contained in:
Christoffer Lerno
2022-10-20 21:54:40 +02:00
parent e15dbd4907
commit e6a5f98606
5 changed files with 11 additions and 10 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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");

View File

@@ -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

View File

@@ -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