-
Notifications
You must be signed in to change notification settings - Fork 567
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
printf %a mishandles subnormals #15495
Comments
From zefram@fysh.orgCreated by zefram@fysh.org$ perl -lwe 'printf "%a\n", 3e-320' This output is numerically incorrect. This happens for any subnormal $ perl -MData::Float=float_hex -lwe 'print float_hex(3e-320, {subnormal_strategy=>$_}) for qw(SUBNORMAL NORMAL)' Perl Info
|
From @tonycozOn Thu Aug 04 13:51:17 2016, zefram@fysh.org wrote:
The handling of the implicit one bit is incorrect too.
It looks like subnormals simply weren't implemented: /* XXX Inf/NaN/denormal handling in the HEXTRACT_IMPLICIT_BIT, Tony |
The RT System itself - Status changed from 'new' to 'open' |
From @jhihttp://perl5.git.perl.org/perl.git/commit/b6d9b423fab1963346eb79e83b356114396b1f2e |
From zefram@fysh.orgJarkko Hietaniemi via RT wrote:
When I first reviewed this, before Jarkko merged it to blead, I thought With IEEE double: $ perl -lwe 'printf "%a\n", 0x1.fffffffffffffp-1022' The first one here (which is normalised) is OK, but the subnormals All of the incorrect ones have the pattern of showing a normalised-style As far as I can see, the problem arises with any magnitude in the range With x86 80-bit long double, the behaviour is stranger: $ perl -lwe 'printf "%a\n", 0x1.fffffffffffffffep0 * 2**-16382' Subnormals here are consistently showing the integer and fractional Things get even weirder for certain subnormals in this format: $ perl -lwe 'printf "%a\n", 0x0.1000000000000000p0 * 2**-16382' Where only one output hex digit is non-zero, in addition to the initial -zefram |
From @jkeenanOn Sat Aug 13 16:19:16 2016, zefram@fysh.org wrote:
I've been following the discussion in this RT, as well as noting the filing of 5 other bug reports related to 'printf'. Those other reports are: https://rt-archive.perl.org/perl5/Ticket/Display.html?id=128888 (Each of the above is still in New status.) I have to admit I'm confused as to where the discussion in going. In particular, I'm concerned about the fact that no one has cited any standards for the behavior of 'printf' that we presumably have failed to meet up until now and ought to be meeting going forward. It's not clear on what basis, other than personal knowledge, participants in the discussion are making their claims or making code changes. For those following along at home, this is unsatisfying. Could we step back from the discussion for a moment and provide some links to standards we ought to be meeting? Thank you very much. -- |
From zefram@fysh.orgJames E Keenan via RT wrote:
I've based my expectations on the C standard, to the extent that it's -zefram |
From @jhiI've been following the discussion in this RT, as well as noting the
Yeah, sorry. I see Zefram already pointed out some of the relevant docs. In addition to the C99 (the first one in which the hexfp literals or the %a There often seems to be some differences in the interpretation of the standards, |
From @jhi
Hrm. I'll try to take a look again tonight. |
From zefram@fysh.orgJarkko Hietaniemi via RT wrote:
sprintf2.t for double-double: [ '%a', '-1', '-0x0p+0' ], Expected result should be '-0x1p+0'. sprintf2.t has a comment about tests for this ticket (#128843) for the Other than that the %a tests look fine. -zefram |
From @jhiMarking resolved until proven otherwise. |
@jhi - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#128843 (status was 'resolved')
Searchable as RT128843$
The text was updated successfully, but these errors were encountered: