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

Add $PDL::indxformat for PDL_Indx #172

Merged
merged 3 commits into from Nov 14, 2015
Merged

Conversation

devel-chm
Copy link
Member

This avoids loss of significance when 64bit PDL_Indx
values are printed. Part of the 64bit cleanup and polish
for PDL-2.015 (planned for release by Dec 2015)

This avoids loss of significance when 64bit PDL_Indx
values are printed.
This allows pdl(indx, '[ 9007199254740992 ]') to work
without rounding due to the 52bit double precision
mantissa versus the 63bits + sign for PDL_Indx.
I can't believe this hasn't been documented already.
@devel-chm
Copy link
Member Author

I discovered that pdl( indx(), ... ) works while I was working through the $PDL::indxformat stuff! Amazing how you can still learn something fundamental after all this time. Put some examples in the POD so others will realize it can be done. Probably one of those "well known to those who know it well things"!

After the fixes, this seems to work for me, I would appreciate independent verification:

use PDL;

$PDL::use_commas=1;

$dseq2 = sequence(double, 3,5);
$iseq2 = sequence(indx,   3,5);

$strq2 = ($iseq2+9007199254740992)->string;
print "\$strq2 is $strq2\n";

$ssq2 = pdl( indx(), $strq2 );
print "\$ssq2 is $ssq2\n";

$diffi  = pdl( indx, ($iseq2+9007199254740992)->string ) - 9007199254740992;
print "\$diffi is $diffi\n";

$diffii = pdl( indx, ($iseq2+9007199254740992)->string ) - indx(9007199254740992);
print "\$diffii is $diffii\n";

@wchristian wchristian merged commit 0510517 into master Nov 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants