MCPcopy Create free account
hub / github.com/numpy/numpy / _init

Method _init

numpy/core/getlimits.py:540–564  ·  view source on GitHub ↗
(self, dtype)

Source from the content-addressed store, hash-verified

538 return obj
539
540 def _init(self, dtype):
541 self.dtype = numeric.dtype(dtype)
542 machar = _get_machar(dtype)
543
544 for word in ['precision', 'iexp',
545 'maxexp', 'minexp', 'negep',
546 'machep']:
547 setattr(self, word, getattr(machar, word))
548 for word in ['resolution', 'epsneg', 'smallest_subnormal']:
549 setattr(self, word, getattr(machar, word).flat[0])
550 self.bits = self.dtype.itemsize * 8
551 self.max = machar.huge.flat[0]
552 self.min = -self.max
553 self.eps = machar.eps.flat[0]
554 self.nexp = machar.iexp
555 self.nmant = machar.it
556 self._machar = machar
557 self._str_tiny = machar._str_xmin.strip()
558 self._str_max = machar._str_xmax.strip()
559 self._str_epsneg = machar._str_epsneg.strip()
560 self._str_eps = machar._str_eps.strip()
561 self._str_resolution = machar._str_resolution.strip()
562 self._str_smallest_normal = machar._str_smallest_normal.strip()
563 self._str_smallest_subnormal = machar._str_smallest_subnormal.strip()
564 return self
565
566 def __str__(self):
567 fmt = (

Callers 1

__new__Method · 0.45

Calls 3

_get_macharFunction · 0.85
stripMethod · 0.80
dtypeMethod · 0.45

Tested by

no test coverage detected