-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathftoa.go
More file actions
29 lines (24 loc) · 705 Bytes
/
Copy pathftoa.go
File metadata and controls
29 lines (24 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright 2016 Nicolas Dade. Derived from the go 1.7.4
// standard library, which itself was:
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Binary to decimal floating point conversion.
// Algorithm:
// 1) store mantissa in multiprecision decimal
// 2) shift decimal by exponent
// 3) read digits out & format
package bytesconv
// TODO: move elsewhere?
type floatInfo struct {
mantbits uint
expbits uint
bias int
}
var float32info = floatInfo{23, 8, -127}
var float64info = floatInfo{52, 11, -1023}
type decimalSlice struct {
d []byte
nd, dp int
neg bool
}