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

Method __init__

numpy/core/getlimits.py:34–60  ·  view source on GitHub ↗
(self, ftype, *, eps, epsneg, huge, tiny,
                 ibeta, smallest_subnormal=None, **kwargs)

Source from the content-addressed store, hash-verified

32class MachArLike:
33 """ Object to simulate MachAr instance """
34 def __init__(self, ftype, *, eps, epsneg, huge, tiny,
35 ibeta, smallest_subnormal=None, **kwargs):
36 self.params = _MACHAR_PARAMS[ftype]
37 self.ftype = ftype
38 self.title = self.params['title']
39 # Parameter types same as for discovered MachAr object.
40 if not smallest_subnormal:
41 self._smallest_subnormal = nextafter(
42 self.ftype(0), self.ftype(1), dtype=self.ftype)
43 else:
44 self._smallest_subnormal = smallest_subnormal
45 self.epsilon = self.eps = self._float_to_float(eps)
46 self.epsneg = self._float_to_float(epsneg)
47 self.xmax = self.huge = self._float_to_float(huge)
48 self.xmin = self._float_to_float(tiny)
49 self.smallest_normal = self.tiny = self._float_to_float(tiny)
50 self.ibeta = self.params['itype'](ibeta)
51 self.__dict__.update(kwargs)
52 self.precision = int(-log10(self.eps))
53 self.resolution = self._float_to_float(
54 self._float_conv(10) ** (-self.precision))
55 self._str_eps = self._float_to_str(self.eps)
56 self._str_epsneg = self._float_to_str(self.epsneg)
57 self._str_xmin = self._float_to_str(self.xmin)
58 self._str_xmax = self._float_to_str(self.xmax)
59 self._str_resolution = self._float_to_str(self.resolution)
60 self._str_smallest_normal = self._float_to_str(self.xmin)
61
62 @property
63 def smallest_subnormal(self):

Callers

nothing calls this directly

Calls 5

_float_to_floatMethod · 0.95
_float_convMethod · 0.95
_float_to_strMethod · 0.95
updateMethod · 0.80
log10Function · 0.50

Tested by

no test coverage detected