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

Function test_subnormal_warning

numpy/core/tests/test_getlimits.py:166–185  ·  view source on GitHub ↗

Test that the subnormal is zero warning is not being raised.

()

Source from the content-addressed store, hash-verified

164
165
166def test_subnormal_warning():
167 """Test that the subnormal is zero warning is not being raised."""
168 with np.errstate(all='ignore'):
169 ld_ma = _discovered_machar(np.longdouble)
170 bytes = np.dtype(np.longdouble).itemsize
171 with warnings.catch_warnings(record=True) as w:
172 warnings.simplefilter('always')
173 if (ld_ma.it, ld_ma.maxexp) == (63, 16384) and bytes in (12, 16):
174 # 80-bit extended precision
175 ld_ma.smallest_subnormal
176 assert len(w) == 0
177 elif (ld_ma.it, ld_ma.maxexp) == (112, 16384) and bytes == 16:
178 # IEE 754 128-bit
179 ld_ma.smallest_subnormal
180 assert len(w) == 0
181 else:
182 # Double double
183 ld_ma.smallest_subnormal
184 # This test may fail on some platforms
185 assert len(w) == 0
186
187
188def test_plausible_finfo():

Callers

nothing calls this directly

Calls 2

_discovered_macharFunction · 0.90
dtypeMethod · 0.45

Tested by

no test coverage detected