Skip to content

Commit 2e67514

Browse files
Jan Merclgriesemer
Jan Mercl
authored andcommitted
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 <[email protected]>
1 parent 7f583a4 commit 2e67514

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/float_lit2.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ import (
1313
"math"
1414
)
1515

16-
// The largest exact float32 is f₁ = (1+(1-2²³))×2¹²⁷ = (1-2²⁴)×2¹² = 2¹²⁸ - 2¹⁰⁴.
16+
// The largest exact float32 is f₁ = (1+1-1/2²³)×2¹²⁷ = (2-2⁻²³)×2¹² = 2¹²⁸ - 2¹⁰⁴.
1717
// The next float32 would be f₂ = (1+1)×2¹²⁷ = 1×2¹²⁸, except that exponent is out of range.
1818
// Float32 conversion rounds to the nearest float32, rounding to even mantissa:
1919
// between f₁ and f₂, values closer to f₁ round to f₁ and values closer to f₂ are rejected as out of range.
2020
// f₁ is an odd mantissa, so the halfway point (f₁+f₂)/2 rounds to f₂ and is rejected.
21-
// The halfway point is (f₁+f₂)/2 = 2¹²⁸ - 2¹⁰.
21+
// The halfway point is (f₁+f₂)/2 = 2¹²⁸ - 2¹⁰³.
2222
//
2323
// The same is true of float64, with different constants: s/24/53/ and s/128/1024/.
2424

0 commit comments

Comments
 (0)