in reply to converting big hex to dec
Update: Apparently I should point out that this code (obviously) has the same limitation as any code that uses Perl's NV (double) format numbers, it is limited to 53-bits of precision.
sub hex16dec{ my( $hi, $lo ) = split '(.{8}$)', $_[0]; return hex( $hi ) * 2**32 + hex( $lo ); } $value = '123456789ABCDEF'; printf "%.f\n", hex16dec $value; 81985529216486896
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: converting big hex to dec
by jmcnamara (Monsignor) on Sep 27, 2005 at 12:45 UTC | |
by BrowserUk (Patriarch) on Sep 27, 2005 at 13:54 UTC | |
by jmcnamara (Monsignor) on Sep 27, 2005 at 14:49 UTC | |
|
Re^2: converting big hex to dec
by merlyn (Sage) on Sep 27, 2005 at 16:48 UTC | |
by BrowserUk (Patriarch) on Sep 27, 2005 at 17:09 UTC |