summaryrefslogtreecommitdiff
path: root/src/pkg/math/const.go
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2009-07-28 12:57:33 -0700
committerRob Pike <r@golang.org>2009-07-28 12:57:33 -0700
commit6d345525fc0ebefe1e1b79ed964309f461c4ec14 (patch)
treeeefb3e35e5f89f413d891198c3fedf4b9f6692de /src/pkg/math/const.go
parentf959eb1b744deae0e531818d59651e6e7f2623e9 (diff)
downloadgolang-6d345525fc0ebefe1e1b79ed964309f461c4ec14.tar.gz
constants for integer limits
R=rsc DELTA=16 (16 added, 0 deleted, 0 changed) OCL=32288 CL=32288
Diffstat (limited to 'src/pkg/math/const.go')
-rw-r--r--src/pkg/math/const.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/pkg/math/const.go b/src/pkg/math/const.go
index f1598df9f..837fe6bc9 100644
--- a/src/pkg/math/const.go
+++ b/src/pkg/math/const.go
@@ -21,11 +21,27 @@ const (
Log2E = 1/Ln2;
Ln10 = 2.30258509299404568401799145468436420760110148862877297603332790; // A002392
Log10E = 1/Ln10;
+)
+// Limit values
+const (
MaxFloat32 = 3.40282346638528860e+38;
MinFloat32 = 1.40129846432481707e-45;
MaxFloat64 = 1.7976931348623157e+308;
MinFloat64 = 5.0e-324;
+
+ MaxInt8 = 1<<7 - 1;
+ MinInt8 = -1<<7;
+ MaxInt16 = 1<<15 - 1;
+ MinInt16 = -1<<15;
+ MaxInt32 = 1<<31 - 1;
+ MinInt32 = -1<<31;
+ MaxInt64 = 1<<63 - 1;
+ MinInt64 = -1<<63;
+ MaxUint8 = 1<<8 - 1;
+ MaxUint16 = 1<<16 - 1;
+ MaxUint32 = 1<<32 - 1;
+ MaxUint64 = 1<<64 - 1;
)
// BUG(rsc): The manual should define the special cases for all of these functions.