pkg encoding/json, method (*RawMessage) MarshalJSON() ([]uint8, error)
+pkg math, const MaxFloat64 = 1.79769e+308 // 179769313486231570814527423731704356798100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+pkg math, const SmallestNonzeroFloat64 = 4.94066e-324 // 4940656458412465441765687928682213723651/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
pkg math/big, const MaxBase = 36
pkg math/big, type Word uintptr
pkg net, func ListenUnixgram(string, *UnixAddr) (*UDPConn, error)
package const1
+import "math"
+
const(
mi = ^int(0)
mu = ^uint(0)
// without overflow. For now we match the compiler.
// See also issue #44057.
// smallestFloat64 = 1.0 / (1<<(1023 - 1 + 52))
- smallestFloat64 = 4.940656458412465441765687928682213723651e-324
+ smallestFloat64 = math.SmallestNonzeroFloat64
)
const (
// without overflow. For now we match the compiler.
// See also issue #44057.
// maxFloat64 = 1<<1023 * (1<<53 - 1) / (1.0<<52)
- maxFloat64 = 1.797693134862315708145274237317043567981e+308
+ maxFloat64 = math.MaxFloat64
)
const (
_ = assert(float64(smallestFloat32) == smallestFloat32)
_ = assert(float64(smallestFloat32/2) == smallestFloat32/2)
_ = assert(float64(smallestFloat64) == smallestFloat64)
- // TODO(gri) With the change to the declaration of smallestFloat64
- // this now fails to be true. See issue #44058.
- // _ = assert(float64(smallestFloat64/2) == 0)
+ _ = assert(float64(smallestFloat64/2) == 0)
)
const (
package const1
+import "math"
+
const(
mi = ^int(0)
mu = ^uint(0)
// without overflow. For now we match the compiler.
// See also issue #44057.
// smallestFloat64 = 1.0 / (1<<(1023 - 1 + 52))
- smallestFloat64 = 4.940656458412465441765687928682213723651e-324
+ smallestFloat64 = math.SmallestNonzeroFloat64
)
const (
// without overflow. For now we match the compiler.
// See also issue #44057.
// maxFloat64 = 1<<1023 * (1<<53 - 1) / (1.0<<52)
- maxFloat64 = 1.797693134862315708145274237317043567981e+308
+ maxFloat64 = math.MaxFloat64
)
const (
_ = assert(float64(smallestFloat32) == smallestFloat32)
_ = assert(float64(smallestFloat32/2) == smallestFloat32/2)
_ = assert(float64(smallestFloat64) == smallestFloat64)
- // TODO(gri) With the change to the declaration of smallestFloat64
- // this now fails to be true. See issue #44058.
- // _ = assert(float64(smallestFloat64/2) == 0)
+ _ = assert(float64(smallestFloat64/2) == 0)
)
const (
}
}
+func TestFloatMinima(t *testing.T) {
+ if q := float32(SmallestNonzeroFloat32 / 2); q != 0 {
+ t.Errorf("float32(SmallestNonzeroFloat32 / 2) = %g, want 0", q)
+ }
+ if q := float64(SmallestNonzeroFloat64 / 2); q != 0 {
+ t.Errorf("float64(SmallestNonzeroFloat64 / 2) = %g, want 0", q)
+ }
+}
+
var indirectSqrt = Sqrt
// TestFloat32Sqrt checks the correctness of the float32 square root optimization result.
MaxFloat32 = 3.40282346638528859811704183484516925440e+38 // 2**127 * (2**24 - 1) / 2**23
SmallestNonzeroFloat32 = 1.401298464324817070923729583289916131280e-45 // 1 / 2**(127 - 1 + 23)
- MaxFloat64 = 1.797693134862315708145274237317043567981e+308 // 2**1023 * (2**53 - 1) / 2**52
- SmallestNonzeroFloat64 = 4.940656458412465441765687928682213723651e-324 // 1 / 2**(1023 - 1 + 52)
+ MaxFloat64 = 1.79769313486231570814527423731704356798070e+308 // 2**1023 * (2**53 - 1) / 2**52
+ SmallestNonzeroFloat64 = 4.9406564584124654417656879286822137236505980e-324 // 1 / 2**(1023 - 1 + 52)
)
// Integer limit values.