in reply to Rounding off ?

Somehow, your BigInts are transformed into double-precision floating point numbers before being handed to printf:

$ tcc -run - #include <inttypes.h> #include <stdint.h> #include <stdio.h> int main(void) { printf("%" PRIx64 "\n", (uint64_t)(double)0x3243bcfe21ef4468ULL); return 0; } ^D 3243bcfe21ef4400
But you can use as_hex() of Math::BigInt (also available in new versions: to_hex()) to get the original hex representation back:
$ perl -MMath::BigInt -E'say Math::BigInt->new("0x3243bcfe21ef4468")-> +as_hex' 0x3243bcfe21ef4468

Replies are listed 'Best First'.
Re^2: Rounding off ?
by syphilis (Archbishop) on Sep 15, 2018 at 08:16 UTC
    printf("%" PRIx64 "\n", (uint64_t)(double)0x3243bcfe21ef4468ULL);

    Nice explanation - thanks.
    The integer values being output for the OP appeared to be 54-bit precision, and that threw me somewhat.
    But I was excluding only the trailing zero bits from the precision count, while I should also have been excluding the leading zero bits.

    It all makes sense now ... for some definition of "makes sense" ;-)

    Cheers,
    Rob
      Actually, it was your reply that triggered something in my head ("hmm, isn't it doubles that contain fifty something bits of the fraction?") and made me investigate.