| // 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} |