Board index » delphi » faster file-writing and cos functions?

faster file-writing and cos functions?

Anyone have any COS funcitions that are faster than the standard ones? A table
really isn't an option for what I am working on, but it doesn't have to be
particularly accurate.  Also, is there any faster way to write to a file than
BLOCKWRITE (I already have  a large buffer that is a multiple of the block
size) In C I know you can directly call the DOS functions. gracias.
--
The Crow - thec...@iconn.net
"It can't rain all the time"
-Kryptology
 

Re:faster file-writing and cos functions?


Quote
>Anyone have any COS funcitions that are faster than the standard ones? A table
>really isn't an option for what I am working on, but it doesn't have to be
>particularly accurate.

The following is helpful if you need a fast, simple cosine function _generator_.
Each call gives the next value in the cosine sequence:

    const
    { Adjust these values for desired cosine wave.  Values below repeat
      every 80 counts: }
      CosInit = 200;  { Max value (+/-) }
      CosInc  = 1;    { Increment value }
    var
      CosValue: integer;  
      Vel:      integer;  

    Function Cosine: integer;
    begin
      If CosValue >= 0 then
        Vel := Vel - CosInc
      else
        Vel := Vel + CosInc;
      CosValue := CosValue + Vel;
      Cosine := CosValue;
    end;

    var
      I: integer;
    begin
      CosValue := CosInit;  { Init values }
      Vel := 0;

      For I := 1 to 80 do   { Demonstration }
        WriteLn(Cosine);
    end.      

Disregard if this isn't what you're looking for.

Ron Muzzi, EE
Great Lakes Environmental Research Lab
Ann Arbor, Michigan
rmu...@glerl.noaa.gov

Other Threads