Skip to content

Power PC long double repr needs more precision. #7940

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

Closed
charris opened this issue Aug 15, 2016 · 5 comments
Closed

Power PC long double repr needs more precision. #7940

charris opened this issue Aug 15, 2016 · 5 comments
Labels

Comments

@charris
Copy link
Member

charris commented Aug 15, 2016

On PPC this test fails as reported in #7836

    o = 1 + np.finfo(np.longdouble).eps
    assert_equal(np.longdouble(repr(o)), o,
                 "repr was %s" % repr(o))

with


AssertionError:
Items are not equal: repr was 1.0
 ACTUAL: 1.0
 DESIRED: 1.0

Among other things, probably finfo, it looks like repr does not have sufficient digits.

@juliantaylor
Copy link
Contributor

duplicate of #2669
see also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702169
finfo actually returns too much precision

@charris
Copy link
Member Author

charris commented Feb 3, 2017

Should be closed by #8504.

@charris charris closed this as completed Feb 3, 2017
@matthew-brett
Copy link
Contributor

@matthew-brett matthew-brett reopened this Feb 4, 2017
@matthew-brett
Copy link
Contributor

The problem is that the eps is too small for the repr precision.

The longdouble repr print precision is unconditionally set to be the same as the double repr precision == 17 in scalartypes.c.src. (The actual double precision is 15). Then, any longdouble that has eps > 1e-18 will generate a repr '1.0' for 1 + eps. For example, this same test fails on SPARC (float128).

Should the longdobule repr precision depend on the longdouble type? (33 digits in the case of SPARC float128, 31 in the case of PPC longdouble). Or should we skip this test for precision > 18 digits?

@eric-wieser
Copy link
Member

eric-wieser commented Feb 21, 2017

Sorry, in what way is NPY_SIZEOF_LONGDOUBLE == NPY_SIZEOF_DOUBLE "unconditional"?

(or has that file changed since you linked to it?)

matthew-brett added a commit to matthew-brett/numpy that referenced this issue Feb 22, 2017
Precision of repr set to 22 when longdouble != double, but this isn't
enough for double double (precision 33) or float128 (precision 34).  If
repr precision is not high enough to show eps value, skip the test.

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

No branches or pull requests

4 participants