I can't reproduce that here, I'm getting the output:

3243BCFE21EF4468 EF453276BDBDE566 2342ED65876AB55F

Maybe you're on a 32-bit build of Perl?* Also, what version of Perl are you on? Maybe you could post the output of perl -V here.

Anyway, yes, it's possible you're seeing some rounding effects, although I'm not sure exactly what since I can't see it here. printf is probably numifying the object into a regular Perl number, which may not be large enough to hold the value*. However, Math::BigInt provides the as_hex method:

use warnings; use strict; use Math::BigInt; my @CRCTable = ( Math::BigInt->new("0x3243bcfe21ef4468"), Math::BigInt->new("0xef453276bdbde566"), Math::BigInt->new("0x2342ed65876ab55f"), ); for my $crc (@CRCTable) { print $crc->as_hex, "\n"; } __END__ 0x3243bcfe21ef4468 0xef453276bdbde566 0x2342ed65876ab55f

* Update: Based on the replies I have to revise my guess: maybe you are doing some operations on the BitInts that you haven't shown here? Are you certain that the output you've posted here is exactly what you get when you run the exact code you've posted here? If yes, maybe there's something different about your build of Perl. In addition to the output of perl -V, please show the output of perl -MMath::BigInt -le 'print $Math::BigInt::VERSION'.


In reply to Re: Rounding off ? (updated) by haukex
in thread Rounding off ? by Zomalaja

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.