[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accuracy in attodollars for daily storage calculation



On 08/13/11 21:03, Teresa L. Johnson wrote:
> Total bytes stored: 721777623 bytes
> Price charged: 0.006984944482595037 dollars
> 
> Using `bc -l` to recreate the calculation, I get the following:
> 
> 721777623.0 * 0.0000000003 / 31.0
> .006984944738709677
> 
> The comparison:
> 
> Tarsnap: 0.006984944482595037
> Mine:    0.006984944738709677
>                     ^^^^^^^^^

Heh, I was wondering when someone would notice this. ;-)

> So, is the definition of 'daily' not 1/31 (for the month of August)?
> 
> Out of curiosity, how is the daily storage in attodollars per byte-month calculated in our accounts?

It's a question of where the rounding is done.  Tarsnap computes the cost per
byte-day of storage, throws away any fractional attodollars, then multiplies
that by the number of bytes of storage you're using.  Since you have about
700 million bytes of data stored, this rounding error saves you 700 million
partial attodollars -- or about 250 picodollars.

The actual prices turn out to be 9677419 a$/byte/day in months with 31 days,
10000000 a$/byte/day in months with 30 days, 10344827 a$/byte/day in months
with 29 days, and 10714285 a$/byte/day in months with 28 days.

-- 
Colin Percival
Security Officer, FreeBSD | freebsd.org | The power to serve
Founder / author, Tarsnap | tarsnap.com | Online backups for the truly paranoid