github.com/jgbaldwinbrown/perf@v0.1.1/benchfmt/internal/bytesconv/ftoa.go (about) 1 // Copyright 2009 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Binary to decimal floating point conversion. 6 // Algorithm: 7 // 1) store mantissa in multiprecision decimal 8 // 2) shift decimal by exponent 9 // 3) read digits out & format 10 11 package bytesconv 12 13 // TODO: move elsewhere? 14 type floatInfo struct { 15 mantbits uint 16 expbits uint 17 bias int 18 } 19 20 var float32info = floatInfo{23, 8, -127} 21 var float64info = floatInfo{52, 11, -1023}