home *** CD-ROM | disk | FTP | other *** search
- //------<<< SINCOS.C ANFANG >>>-----------------------------
- #include<dos.h>
- #include<float.h>
- #include<stdio.h>
-
- //---- Typendeklarationen ----------------------------------
- typedef double dword;
- typedef unsigned char byte;
- typedef unsigned int word;
-
- /* ---------
- --------------- SINUS -------------------------------------
- - --------- -
- - Autor: Ulrich Schmitz & toolbox 1990 -
- - Compiler: Turbo C++ -
- - AUFRUF: dword sinus(dword winkel); -
- - EINGABE: 4-Byte Winkelwert. -
- - RÜCKGABE: Sinus (RAD) des Winkelwertes als dword -
- - bzw. float oder long-Wert. -
- - Funktion: Berechnet den Sinus zu einem vorgegebenen -
- - Winkel. -
- -----------------------------------------------------------
- */
-
- dword sinus(dword Winkel)
- {
- dword Ergebnis;
- // Coprozessor-Befehle erfordern 80x87 Arithmetikprozessor *
- asm FINIT; // Coprozessor initialisieren
- asm FLD Winkel; // 32-Bit-Operand auf Stack
- asm FPTAN;
- asm FLD ST(1);
- asm FMUL ST,ST;
- asm FXCH;
- asm FMUL ST,ST;
- asm FADD;
- asm FSQRT;
- asm FDIV;
- asm FST Ergebnis; // Ergebnis zurückgeben
- return Ergebnis;
- }
-
-
-
- /* -----------
- --------------- COSINUS -----------------------------------
- - ----------- -
- - Autor: Ulrich Schmitz & toolbox 1990 -
- - Compiler: Turbo C++ -
- - AUFRUF: dword cosinus(dword Winkel) -
- - EINGABE: Winkelwert als Doppelwort (4 Byte) -
- - RÜCKGABE: Cosinus (RAD) des Winkels als dword -
- - bzw. float oder long-Wert. -
- - Funktion: Berechnet den Cosinus zu einem gegebenem -
- - Winkel. -
- -----------------------------------------------------------
- */
-
- dword cosinus(dword Winkel)
- {
- dword Ergebnis;
- // Coprozessor-Befehle erfordern 80x87 Arithmetikprozessor *
- asm FINIT;
- asm FLD Winkel;
- asm FPTAN;
- asm FLD ST(1);
- asm FMUL ST,ST;
- asm FXCH;
- asm FMUL ST,ST;
- asm FDIV;
- asm FLD1;
- asm FADD;
- asm FSQRT;
- asm FLD1;
- asm FDIVR;
- asm FST Ergebnis;
- return Ergebnis;
- }
- //------<<< SINCOS.C ENDE >>>-------------------------------