1
0
mirror of https://github.com/golang/go synced 2024-11-12 06:20:22 -07:00

floating-point limits and equations

R=r
DELTA=13  (8 added, 2 deleted, 3 changed)
OCL=32291
CL=32322
This commit is contained in:
Russ Cox 2009-07-28 14:50:50 -07:00
parent 92c3627950
commit e50d3ba7e4

View File

@ -23,13 +23,19 @@ const (
Log10E = 1/Ln10;
)
// Limit values
// Floating-point limit values.
// Max is the largest finite value representable by the type.
// Min is the smallest nonzero value representable by the type.
const (
MaxFloat32 = 3.40282346638528860e+38;
MinFloat32 = 1.40129846432481707e-45;
MaxFloat64 = 1.7976931348623157e+308;
MinFloat64 = 5.0e-324;
MaxFloat32 = 3.40282346638528859811704183484516925440e+38; /* 2^127 * (2^24 - 1) / 2^23 */
MinFloat32 = 1.401298464324817070923729583289916131280e-45; /* 1 / 2^(127 - 1 + 23) */
MaxFloat64 = 1.797693134862315708145274237317043567981e+308; /* 2^1023 * (2^53 - 1) / 2^52 */
MinFloat64 = 4.940656458412465441765687928682213723651e-324; /* 1 / 2^(1023 - 1 + 52) */
)
// Integer limit values.
const (
MaxInt8 = 1<<7 - 1;
MinInt8 = -1<<7;
MaxInt16 = 1<<15 - 1;