github.com/gopherd/gonum@v0.0.4/internal/testrand/extremes.go (about)

     1  // Copyright ©2020 The Gonum Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package testrand
     6  
     7  import "math"
     8  
     9  const (
    10  	maxUint = ^uint(0)
    11  	maxInt  = int(maxUint >> 1)
    12  )
    13  
    14  var (
    15  	extremeFloat64Unit = [...]float64{
    16  		0,
    17  		math.SmallestNonzeroFloat64,
    18  		0.5,
    19  		1 - math.SmallestNonzeroFloat64,
    20  		1,
    21  	}
    22  
    23  	extremeFloat64Norm = [...]float64{
    24  		-math.MaxFloat64,
    25  		-math.MaxFloat64 / 2,
    26  		-1,
    27  		-math.SmallestNonzeroFloat64,
    28  		0,
    29  		math.SmallestNonzeroFloat64,
    30  		1,
    31  		math.MaxFloat64 / 2,
    32  		math.MaxFloat64,
    33  	}
    34  
    35  	extremeFloat64Exp = [...]float64{
    36  		0,
    37  		math.SmallestNonzeroFloat64,
    38  		1,
    39  		math.MaxFloat64 / 2,
    40  		math.MaxFloat64,
    41  	}
    42  
    43  	extremeFloat32Unit = [...]float32{
    44  		0,
    45  		math.SmallestNonzeroFloat32,
    46  		0.5,
    47  		1 - math.SmallestNonzeroFloat32,
    48  		1,
    49  	}
    50  
    51  	extremeInt = [...]int{
    52  		0,
    53  		1,
    54  		maxInt / 2,
    55  		maxInt - 1,
    56  		maxInt,
    57  	}
    58  
    59  	extremeInt31 = [...]int32{
    60  		0,
    61  		1,
    62  		math.MaxInt32 / 2,
    63  		math.MaxInt32 - 1,
    64  		math.MaxInt32,
    65  	}
    66  
    67  	extremeInt63 = [...]int64{
    68  		0,
    69  		1,
    70  		math.MaxInt64 / 2,
    71  		math.MaxInt64 - 1,
    72  		math.MaxInt64,
    73  	}
    74  
    75  	extremeUint32 = [...]uint32{
    76  		0,
    77  		1,
    78  		math.MaxUint32 / 2,
    79  		math.MaxUint32 - 1,
    80  		math.MaxUint32,
    81  	}
    82  
    83  	extremeUint64 = [...]uint64{
    84  		0,
    85  		1,
    86  		math.MaxUint64 / 2,
    87  		math.MaxUint64 - 1,
    88  		math.MaxUint64,
    89  	}
    90  )