Table of Contents

Class iinfo

Namespace
NumSharp
Assembly
NumSharp.dll

Machine limits for integer types.

public sealed class iinfo
Inheritance
iinfo
Inherited Members

Remarks

Constructors

iinfo(DType)

Create iinfo for the specified dtype — NumPy's iinfo(int_type) class call.

public iinfo(DType int_type)

Parameters

int_type DType

An integer dtype (a Type, NPTypeCode, dtype string or DType — all convert implicitly). NumPy's keyword name.

Remarks

bool and char stay accepted (NumSharp extensions, see IsIntegerType(NPTypeCode)); NumPy refuses bool ('b', pinned by AuditV2 T1.62).

Exceptions

ArgumentNullException

int_type is null.

ValueError

int_type is not an integer type — NumPy's text, which names the dtype's KIND character: Invalid integer data type 'f'. for every float (decimal included, whose kind is 'f'), 'c' for complex, 'U' / 'S' for text. A ValueError is an ArgumentException, so code that catches the latter still catches it.

Properties

bits

Number of bits occupied by the type.

public int bits { get; }

Property Value

int

dtype

The dtype of this integer type — NumPy's iinfo.dtype (a DType descriptor, like np.iinfo(np.int32).dtype). Being a DType it exposes kind / name / itemsize and compares structurally (info.dtype == np.int32); an NPTypeCode also converts back implicitly.

public DType dtype { get; }

Property Value

DType

kind

Character code for this type. 'i' for signed integers, 'u' for unsigned integers, 'b' for boolean.

public char kind { get; }

Property Value

char

max

Maximum value of given dtype.

public long max { get; }

Property Value

long

Remarks

For unsigned 64-bit integers, the actual max is ulong.MaxValue which exceeds long.MaxValue. Use maxUnsigned to get the true value.

maxUnsigned

Maximum value for unsigned types as ulong. For signed types, this equals max.

public ulong maxUnsigned { get; }

Property Value

ulong

min

Minimum value of given dtype.

public long min { get; }

Property Value

long

Methods

ToString()

NumPy's repr(np.iinfo(dtype)), the same text under every culture: iinfo(min=-128, max=127, dtype=int8), iinfo(min=0, max=18446744073709551615, dtype=uint64).

public override string ToString()

Returns

string

The repr text.

Remarks

NumPy's "%s(min=%s, max=%s, dtype=%s)" of Python ints, which have no culture (parity QA-41: under ar-SA this text was iinfo(min=؜-128, ...), U+061C before the minus, and U+2212 under sv-SE). An unsigned type prints its true maximum (maxUnsigned), so uint64 shows 18446744073709551615 where the max property is clamped to long.MaxValue.