Source File
ldexp.go
Belonging Package
math
// 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.package math// Ldexp is the inverse of Frexp.// It returns frac × 2**exp.//// Special cases are:// Ldexp(±0, exp) = ±0// Ldexp(±Inf, exp) = ±Inf// Ldexp(NaN, exp) = NaNfunc ( float64, int) float64func ( float64, int) float64 {// special casesswitch {case == 0:return // correctly return -0case IsInf(, 0) || IsNaN():return}, := normalize()+=:= Float64bits()+= int(>>shift)&mask - biasif < -1075 {return Copysign(0, ) // underflow}if > 1023 { // overflowif < 0 {return Inf(-1)}return Inf(1)}var float64 = 1if < -1022 { // denormal+= 53= 1.0 / (1 << 53) // 2**-53}&^= mask << shift|= uint64(+bias) << shiftreturn * Float64frombits()}