return n
}
-func makeInt(i *big.Int) constant.Value {
- if i.IsInt64() {
- return constant.Make(i.Int64()) // workaround #42640 (Int64Val(Make(big.NewInt(10))) returns (10, false), not (10, true))
- }
- return constant.Make(i)
-}
-
func makeFloat64(f float64) constant.Value {
if math.IsInf(f, 0) {
base.Fatalf("infinity is not a valid constant")
}
- v := constant.MakeFloat64(f)
- v = constant.ToFloat(v) // workaround #42641 (MakeFloat64(0).Kind() returns Int, not Float)
- return v
+ return constant.MakeFloat64(f)
}
func makeComplex(real, imag constant.Value) constant.Value {
if acc != big.Exact {
base.Fatalf("mantissa scaling failed for %f (%s)", f, acc)
}
- w.mpint(makeInt(manti), typ)
+ w.mpint(constant.Make(manti), typ)
if manti.Sign() != 0 {
w.int64(exp)
}