Here’s a rather unexpected bug with perl sprintf
#! /usr/bin/perl use strict; use warnings; use bigint ; my $a = hex( "0x0A0000001D05A820" ) ; printf( "0x%016X\n", $a ) ; printf( "%d\n", $a ) ; printf( "$a\n" ) ;
The %X printf produces a value where the least significant 0x20 is lost:
$ ./bigint 0x0A0000001D05A800 720575940866189312 720575940866189344
Observe that the loss occurs in the printf and not the hex() call, since 720575940866189344 == 0x0A0000001D05A820.
This bug appears to be fixed in some version of perl <= 5.16.2. Oh, the joys of using ancient operating system versions so that we can support customers on many of the ancient deployments that they seem to like to run on.