SPUG: Working with currency

Michael R. Wolf MichaelRWolf at att.net
Fri Apr 3 00:41:23 PDT 2009


On Apr 3, 2009, at 12:22 AM, Andrew Sweger wrote:

> On Thu, 2 Apr 2009, Yitzchak Scott-Thoennes wrote:
>
>> 2**53 pennies = a bit over 90 trillion dollars
>
> Reference, please? Context? (I mean, just throwing a number like  
> this out
> just doesn't seem fair. 53 bits? That seems... odd.)


I wouldn't have known what to look for, but it was easy to find the  
53, then do a bit of groping around (with grep) to see some related  
values....

$ perl -MConfig=config_sh -e 'print config_sh()'  | grep '^nv'
nvEUformat='"E"'
nvFUformat='"F"'
nvGUformat='"G"'
nv_preserves_uv_bits='53'
nveformat='"e"'
nvfformat='"f"'
nvgformat='"g"'
nvsize='8'
nvtype='double'

Snippet from 'perldoc Config':

        "nv_preserves_uv_bits"
            From perlxv.U:

            This variable indicates how many of bits type uvtype a  
variable
            nvtype can preserve.

$ perl -le 'printf q(%.0f, )x3, (2**53), (2**53)+1, (2**53)-1'
9007199254740992, 9007199254740992, 9007199254740991,

It appears that we can add one to 2**53, but can't subtract one from  
it...


-- 
Michael R. Wolf
     All mammals learn by playing!
         MichaelRWolf at att.net






More information about the spug-list mailing list