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

IRIX longdouble Infinity issues #14993

Closed
p5pRT opened this issue Oct 19, 2015 · 3 comments

Comments

@p5pRT
Copy link
Collaborator

@p5pRT p5pRT commented Oct 19, 2015

Migrated from rt.perl.org#126396 (status was 'resolved')

Searchable as RT126396$

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Oct 19, 2015

From @jhi

(blead as of 033a6f7)

Looks like IRIX long double (which happens to be big-endian double-double, but not using PPC as usual, but instead MIPS), has some issues with infinities.

(1) If infinities are involved, multiplication is producing garbage bytes in the second double of the double-double.

If I add byte hexdumps for the NV in Perl_do_ncmp (which is called by pp_eq) I can see for example​:

./perl -wle '"Inf"*1 == "Inf"+0'
7f f0 00 00 00 00 00 00 3f f0 00 00 00 00 00 00
7f f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00

./perl -wle '"Inf"*"Inf" == "Inf"+0'
7f f0 00 00 00 00 00 00 7f ef ff ff ff ff ff ff
7f f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00

The "7f f0" prefix is correct, and all that is needed for an infinity, the rest of the bytes should be zeros.

The "3f f0" and "7f ef ff ... ff" after the midpoint (the second double of double-double) are unexpected garbage.

(2) Then comparison of infinities (pp_eq, the last branch which compares NVs) seems to have issues​: if e.g. the above bogus infinity

7f f0 00 00 00 00 00 00 3f f0 00 00 00 00 00 00

is compared with the true infinity, the bogus one is deemed to be "greater than", presumably because of the non-zero bytes.

Because of these together, the following t/op/infnan.t tests are failing​:

not ok 14 - twice Inf is Inf
not ok 16 - +Inf * +Inf is +Inf
not ok 17 - +Inf * -Inf is -Inf
not ok 18 - -Inf * +Inf is -Inf
not ok 19 - -Inf * -Inf is +Inf

Note that this is all with long doubles​: with normal doubles, no problems in IRIX.

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Oct 19, 2015

From @jhi

On Sun Oct 18 19​:31​:02 2015, jhi wrote​:

(blead as of 033a6f7)

Looks like IRIX long double (which happens to be big-endian double-
double, but not using PPC as usual, but instead MIPS), has some issues
with infinities.

(1) If infinities are involved, multiplication is producing garbage
bytes in the second double of the double-double.

If I add byte hexdumps for the NV in Perl_do_ncmp (which is called by
pp_eq) I can see for example​:

./perl -wle '"Inf"*1 == "Inf"+0'
7f f0 00 00 00 00 00 00 3f f0 00 00 00 00 00 00
7f f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00

./perl -wle '"Inf"*"Inf" == "Inf"+0'
7f f0 00 00 00 00 00 00 7f ef ff ff ff ff ff ff
7f f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00

The "7f f0" prefix is correct, and all that is needed for an infinity,
the rest of the bytes should be zeros.

The "3f f0" and "7f ef ff ... ff" after the midpoint (the second
double of double-double) are unexpected garbage.

(2) Then comparison of infinities (pp_eq, the last branch which
compares NVs) seems to have issues​: if e.g. the above bogus infinity

7f f0 00 00 00 00 00 00 3f f0 00 00 00 00 00 00

is compared with the true infinity, the bogus one is deemed to be
"greater than", presumably because of the non-zero bytes.

Because of these together, the following t/op/infnan.t tests are
failing​:

not ok 14 - twice Inf is Inf
not ok 16 - +Inf * +Inf is +Inf
not ok 17 - +Inf * -Inf is -Inf
not ok 18 - -Inf * +Inf is -Inf
not ok 19 - -Inf * -Inf is +Inf

Note that this is all with long doubles​: with normal doubles, no
problems in IRIX.

Resolved in http​://perl5.git.perl.org/perl.git/commit/3ec400f5ce53ea1a56d283bc6bf59e75762df058

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Oct 19, 2015

@jhi - Status changed from 'new' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.