aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2020-12-14 21:56:25 -0800
committerIan Lance Taylor <iant@golang.org>2020-12-15 20:50:35 +0000
commit412dc2f4d330a519fb7c26e6ecb0f2bbcb876bbb (patch)
tree92136e339d67ee14c2c3a9f6c2931243ac7e797e /test
parent8e2d74b705ea669c7b5e56c81c59a350d5192352 (diff)
downloadgo-412dc2f4d330a519fb7c26e6ecb0f2bbcb876bbb.tar.gz
go-412dc2f4d330a519fb7c26e6ecb0f2bbcb876bbb.zip
test: adjust issue11371 to fit in required precision
The language spec only requires that floating point values be represented with 256 bits, which is about 1e75. The issue11371 test was assuming that the compiler could represent 1e100. Adjusting the test so that it only assumes 256 bits of precision still keeps the test valid, and permits it to pass when using the gofrontend. Change-Id: I9d1006e9adc9438277f4b8002488c912e5d61cc1 Reviewed-on: https://go-review.googlesource.com/c/go/+/278116 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'test')
-rw-r--r--test/fixedbugs/issue11371.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/fixedbugs/issue11371.go b/test/fixedbugs/issue11371.go
index 05b8fcfebe..8acd18fccb 100644
--- a/test/fixedbugs/issue11371.go
+++ b/test/fixedbugs/issue11371.go
@@ -11,7 +11,7 @@ package issue11371
const a int = 1.1 // ERROR "constant 1.1 truncated to integer|floating-point constant truncated to integer"
const b int = 1e20 // ERROR "overflows int|integer constant overflow"
-const c int = 1 + 1e-100 // ERROR "constant truncated to integer"
-const d int = 1 - 1e-100 // ERROR "constant truncated to integer"
+const c int = 1 + 1e-70 // ERROR "constant truncated to integer"
+const d int = 1 - 1e-70 // ERROR "constant truncated to integer"
const e int = 1.00000001 // ERROR "constant truncated to integer"
const f int = 0.00000001 // ERROR "constant 1e-08 truncated to integer|floating-point constant truncated to integer"