

Accuracy of PutSpriteTransformed:

Consider a destination screen area of 5000 by 5000 pixels. This has to be stored internally
as 1/256ths of pixels, i.e. the width is 5000*256=&138800. Next stage is to evaluate the
determinant (area) of the destination:                             
                                                     
Consider a destination rectangle of 0,0 to 5000,5000 pixels.

  Input destination coords use an 8 bit mantissa.
  Destination size of 5000 by 5000 pixels gives:
  Determinant of matrix (=area) = 5000*256 * 5000*256 = &17D78400000 (16 bit mantissa)
                (Store as 18.14, which loses 2 bits off the bottom. It could also lose 10 more...)
  Inverting gives &ABCC706 / (1<<52).
                (Store as 16.48, which loses 22 bits off the bottom)
  Multiplying by xchange or ychange (5000*256) gives &D1B70F2/(1<<32)
                (Store as 32.32, which loses 24 bits off the bottom)
  Multiplying by sprite size gives: size * &D1B70F2 / (1<<24) = increment
                (Store as 16.16, which is pretty accurate, as specified below)

   Xsize      Ysize     Sprite x size   Sprite Y size    Inc Xx     Inc Yy
    5         5000          4                  4          4/5        4/5000
   50         5000          4                  4          4/50       4/5000
   500        5000          4                  4          4/500      4/5000
   5000       5000          4                  4          4/5000     4/5000

Obviously sprite_x_size/Xsize goes between 4000/5=800 to 4/5000=0.0008
These values are stored to 16 bit mantissa accuracy. The table below gives
percentage errors for a range of values:
   Scale factor        Increment             Percentage error (optimal)
     0.00001            100000               0.00000005 %
      0.0001            10000                0.00000014 %
      0.001             1000                 0.00000154 %
       0.01             100                  0.00001527 %
       0.1              10                   0.0001526  %
        1               1                    0.00152588 %
       10               0.1                  0.01525879 %
      100               0.01                 0.15258789 %
      1000              0.001                1.52587891 %
     10000              0.0001               15.2587891 %
     100000             0.00001              152.587891 %
    1000000             0.000001             1525.87891 %
  [Calculated with the formula ((value*65536+1)/(value*65536)-1)*100]

These errors will be produce bad results if the number of pixels to plot (X or Y), multiplied
by the percentage error, gives a value of a pixel on the source sprite (for large sprites)
e.g. Error at edge of sprite (sprite pixels) = error in increment * number of display pixels
              
As it happens, the source size seems to drop out of the equation here. The error turns out
at <destination size>/65536 pixels in the source by the time it reaches the end

Read the following table for more information on the maximum errors attainable:    

   Destination size                     Worst possible error in source pixels
         5                                              0.0000763
         10                                             0.0001526
         50                                             0.0007629
        100                                             0.0015259
        500                                             0.0076294
       1000                                             0.0152588
       5000                                             0.0762939
      10000                                             0.1525879

[ The largest output possible is 32767 pixels ]
