Skip to content

Commit 840c1f7

Browse files
committed
update AstGen float literal parsing
1 parent 1987769 commit 840c1f7

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/AstGen.zig

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6715,13 +6715,7 @@ fn floatLiteral(gz: *GenZir, rl: ResultLoc, node: Ast.Node.Index, sign: Sign) In
67156715

67166716
const main_token = main_tokens[node];
67176717
const bytes = tree.tokenSlice(main_token);
6718-
const unsigned_float_number: f128 = if (bytes.len > 2 and bytes[1] == 'x') hex: {
6719-
assert(bytes[0] == '0'); // validated by tokenizer
6720-
break :hex std.fmt.parseHexFloat(f128, bytes) catch |err| switch (err) {
6721-
error.InvalidCharacter => unreachable, // validated by tokenizer
6722-
error.Overflow => return astgen.failNode(node, "number literal cannot be represented in a 128-bit floating point", .{}),
6723-
};
6724-
} else std.fmt.parseFloat(f128, bytes) catch |err| switch (err) {
6718+
const unsigned_float_number = std.fmt.parseFloat(f128, bytes) catch |err| switch (err) {
67256719
error.InvalidCharacter => unreachable, // validated by tokenizer
67266720
};
67276721
const float_number = switch (sign) {

0 commit comments

Comments
 (0)