[Numpy-discussion] Add smallest_normal and smallest_subnormal attributes to finfo

Stephannie Jiménez Gacha sgacha at quansight.com
Wed Apr 21 18:44:22 EDT 2021

Good afternoon,

Given the discussions happened in the Data API consortium when looking into
the attributes of `finfo` used in the wild, we found that `tiny` is used
regularly but in a good amount of cases not for its intended purpose but
rather as "just give me a small number". Following this we are proposing
the addition of `smallest_normal` and `smallest_subnormal` attributes.
Personally, I think that the `tiny` name is a little bit odd and
misleading, so it will be great to leave that as an alias but have a clear
name in this class.

Right now the PR: https://github.com/numpy/numpy/pull/18536 has all the
changes and all the values added were checked against IEEE-754 standard.
One of the main concerns is the support of subnormal numbers in certain
architectures, where the values can't be calculated accurately. Given the
state of the discussion, we don't know if the best alternative is to not
add the `smallest_subnormal` attribute and just add the `smallest_number`
attribute as an alias to `tiny`.

We open this to discussion to see what way we can go in order to get this
PR merged.

*Stephannie Jimenez Gacha*Software developer

*Quansight* | Your Data Experts

w: www.quansight.com  e: sgacha at quansight.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/numpy-discussion/attachments/20210421/35e95436/attachment.html>

More information about the NumPy-Discussion mailing list