Correct floating-point literal allowed ranges

The exponent range for floating-point values is [-1022, 1023].

Fixes #399.
This commit is contained in:
Marc Tiehuis
2017-08-07 18:06:06 +12:00
parent d8227c79a2
commit 0705b711f8
4 changed files with 22 additions and 2 deletions

View File

@@ -1931,4 +1931,18 @@ pub fn addCases(cases: &tests.CompileErrorContext) {
\\}
,
".tmp_source.zig:1:13: error: struct 'Foo' contains itself");
cases.add("float literal too large error",
\\comptime {
\\ const a = 0x1.0p1024;
\\}
,
".tmp_source.zig:2:15: error: float literal out of range of any type");
cases.add("float literal too small error (denormal)",
\\comptime {
\\ const a = 0x1.0p-1023;
\\}
,
".tmp_source.zig:2:15: error: float literal out of range of any type");
}