float literals now parse using musl's 128 bit float code

fixes float literals not having 128 bit precision
This commit is contained in:
Andrew Kelley
2019-03-22 14:56:03 -04:00
parent 127bb124a0
commit 4615ed5ea0
9 changed files with 1090 additions and 25 deletions

View File

@@ -293,10 +293,10 @@ static void cancel_token(Tokenize *t) {
}
static void end_float_token(Tokenize *t) {
if (t->radix == 10) {
if (t->radix == 10 || t->radix == 16) {
uint8_t *ptr_buf = (uint8_t*)buf_ptr(t->buf) + t->cur_tok->start_pos;
size_t buf_len = t->cur_tok->end_pos - t->cur_tok->start_pos;
if (bigfloat_init_buf_base10(&t->cur_tok->data.float_lit.bigfloat, ptr_buf, buf_len)) {
if (bigfloat_init_buf(&t->cur_tok->data.float_lit.bigfloat, ptr_buf, buf_len)) {
t->cur_tok->data.float_lit.overflow = true;
}
return;