Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEP: Deprecate np.MachAr #20201

Merged
merged 5 commits into from Oct 28, 2021
Merged

DEP: Deprecate np.MachAr #20201

merged 5 commits into from Oct 28, 2021

Conversation

BvB93
Copy link
Member

@BvB93 BvB93 commented Oct 26, 2021

This PR deprecates the np.MachAr class, the matching np.core.machar module and np.finfo.machar attribute.

As an alternative it is recommended to use to directly grab the property of interest from the np.finfo instance.

Note that the module is technically private, but with the lack of underscores it's better to be safe than sorry.

@seberg
Copy link
Member

seberg commented Oct 26, 2021

Is there any use for finfo.machar? Can we just include that in the deprecation (i.e. make it a private variable if we still need it)?

@BvB93
Copy link
Member Author

BvB93 commented Oct 26, 2021

Is there any use for finfo.machar?

There are a few MachAr attributes that are not exposed to finfo.
Some are available under a different name (xmin -> min), but others (ibeta) would have to be added.

In [11]: import numpy as np

In [12]: finfo_f8 = np.finfo(np.float64)
    ...: machar_f8 = np.MachAr(np.float64)

In [14]: set(dir(machar_f8)) - set(dir(finfo_f8))
Out[14]: 
{'_do_init',
 '_str_xmax',
 '_str_xmin',
 'epsilon',
 'huge',
 'ibeta',
 'irnd',
 'it',
 'ngrd',
 'title',
 'xmax',
 'xmin'}

@seberg
Copy link
Member

seberg commented Oct 27, 2021

Hmm, fair point. On some of these, I would be willing to just gamble that nobody uses them anyway, i.e. ibeta is always 2. Some seem like they might be interesting on weird platforms/settings (irnd or ngrd) though, I tend to trying getting rid of them, but not sure.

@BvB93
Copy link
Member Author

BvB93 commented Oct 27, 2021

Ah well, let's give deprecating finfo.machar a shot.

@charris
Copy link
Member

charris commented Oct 28, 2021

Thanks Bas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants