aboutsummaryrefslogtreecommitdiff
path: root/test/float_lit2.go
diff options
context:
space:
mode:
authorJan Mercl <0xjnml@gmail.com>2016-09-14 13:17:37 +0200
committerRobert Griesemer <gri@golang.org>2016-09-14 16:39:47 +0000
commit2e675142dd269348da992c1862a28e56e0a87eb6 (patch)
treedc2f422b5544f6ae6e0923f994fd0055ea31948c /test/float_lit2.go
parent7f583a4d721c94967fe3ce098b3eff902cba043b (diff)
downloadgo-2e675142dd269348da992c1862a28e56e0a87eb6.tar.gz
go-2e675142dd269348da992c1862a28e56e0a87eb6.zip
test/float_lit2: fix expressions in comment
The change corrects the values of the largest float32 value (f1) and the value of the halfway point between f1 and the next, overflow value (f2). Fixes #17012 Change-Id: Idaf9997b69d61fafbffdb980d751c9857732e14d Reviewed-on: https://go-review.googlesource.com/29171 Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'test/float_lit2.go')
-rw-r--r--test/float_lit2.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/float_lit2.go b/test/float_lit2.go
index bb86559a37..901698f8a4 100644
--- a/test/float_lit2.go
+++ b/test/float_lit2.go
@@ -13,12 +13,12 @@ import (
"math"
)
-// The largest exact float32 is f₁ = (1+(1-2²³))×2¹²⁷ = (1-2²⁴)×2¹²⁸ = 2¹²⁸ - 2¹⁰⁴.
+// The largest exact float32 is f₁ = (1+1-1/2²³)×2¹²⁷ = (2-2⁻²³)×2¹²⁷ = 2¹²⁸ - 2¹⁰⁴.
// The next float32 would be f₂ = (1+1)×2¹²⁷ = 1×2¹²⁸, except that exponent is out of range.
// Float32 conversion rounds to the nearest float32, rounding to even mantissa:
// between f₁ and f₂, values closer to f₁ round to f₁ and values closer to f₂ are rejected as out of range.
// f₁ is an odd mantissa, so the halfway point (f₁+f₂)/2 rounds to f₂ and is rejected.
-// The halfway point is (f₁+f₂)/2 = 2¹²⁸ - 2¹⁰⁵.
+// The halfway point is (f₁+f₂)/2 = 2¹²⁸ - 2¹⁰³.
//
// The same is true of float64, with different constants: s/24/53/ and s/128/1024/.