def _special_type(x):
ST_NINF, ST_NEG, ST_NZERO, ST_PZERO, ST_POS, ST_PINF, ST_NAN = range(7)
if math.isnan(x):
return ST_NAN
if math.isfinite(x):
if x != 0:
if math.copysign(1, x) == 1:
return ST_POS
return ST_NEG
if math.copysign(1, x) == 1:
return ST_PZERO
return ST_NZERO
if math.copysign(1, x) == 1:
return ST_PINF
return ST_NINF
评论列表
文章目录