From: ThatWouldBeTelling@thevillage.com   
      
   EricP wrote:   
   > Anton Ertl wrote:   
   >> MitchAlsup writes:   
   >>> So, would it not be easier and faster to simply make a densely-packed   
   >>> 128-bit Fixed-Point decimal function unit ?!?   
   >>   
   >> 128-bit binary integers are mostly good enough, and support for that   
   >> is ok in current architectures; division support might be better,   
   >> though, but see below. Rescaling with a power of 10 is something that   
   >> may merit additional hardware support if it occurs often enough; but I   
   >> am not convinced that it occurs often enough:   
   >>   
   >> You usually don't need it for addition and subtraction, because the   
   >> operands have the same scale factor, and the same scale factor as the   
   >> result.   
   >>   
   >> For multiplication, one common operation is to multiply a price with a   
   >> number of pieces resulting in a price, and no rescaling is necessary   
   >> there. Another common operation is to compute a percentage; you do   
   >> have rescaling there.   
   >>   
   >> For division, it seems to me that the most common case is division by   
   >> a percentage that is applied to many dividends (maybe not in the USA,   
   >> but certainly in Europe it is common to compute the price without VAT   
   >> (sales tax) from the price with VAT; but there are only few VAT rates   
   >> in each country); that can be turned into a two-stage operation that   
   >> might include any necessary rescaling: compute an inverse that can   
   >> then be used for a cheap multiplication-and-rounding operation (e.g.,   
   >> where a power-of-2 scale factor is involved for computing something   
   >> below the least significant digit, in order to implement rounding).   
   >>   
   >> And yes, support for several rounding modes is needed when an inexact   
   >> result is involved. Hardware may be helpful here.   
   >>   
   >> I have not done much financial programming, so maybe somebody else can   
   >> complement my views.   
   >>   
   >> - anton   
   >   
   > Many bonds are time series polynomials with non-integer times.   
   > Many calculations use pow(base,exp) to a non-integer exponent.   
      
   Looking at Black–Scholes derivative and options pricing   
      
   https://en.wikipedia.org/wiki/Black-Scholes_pricing_formula#Blac   
   %E2%80%93Scholes_formula   
      
   I see exp(), ln(), sqrt().   
   I don't see any rules for accuracy.   
   I found double was fine for calculating bonds.   
      
   There are lots of other calculations:   
      
   https://en.wikipedia.org/wiki/Financial_mathematics   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|