Fließkommaroutinen Single Precision

This page is also available in English.


Beschreibung
Die Fließkommaroutinen sind genau die, welche ich in Arcquake verwendet habe, wo sie ganz erheblich zur Beschleunigung beitragen. Sie sind nicht IEEE-kompatibel, allerdings runden manche Funktionen korrekt. Wer sie haben will klicke hier.

Konvertierungsfunktionen
int FIX_FLOAT_MEM_SL(float *f, int s);              // (int)(f*2^s)
int FIXCEIL_FLOAT_MEM_SL(float *f, int s);          // (int)ceil(f*2^s)
void FLOAT_FIX_MEM(int i, float *f);                // f=(float)i;
Makros
void FLOAT_COPY(float *d, float *s);                // d=s;
void FLOAT_ABS(float *d, float *s);                 // d=fabs(s);
void FLOAT_NEG(float *d, float *s);                 // d=-s;
Arithmetikfunktionen
int CMP_FLOAT_MEM(float *a, float *b);              // int?0=a?b
void FLOAT_SL(float *d, float *s, int s);           // d=s*2^s;
void FLOAT_SQRT(float *d, float *s);                // d=sqrt(s);
void ADD_FLOAT_MEM(float *s, float *a, float *b);   // s=a+b; 
void SUB_FLOAT_MEM(float *s, float *a, float *b);   // s=a-b;
void MUL_FLOAT_MEM(float *s, float *a, float *b);   // s=a*b;
void DIV_FLOAT_MEM(float *s, float *a, float *b);   // s=a/b;
void ADotProduct(float *a, float b[3], float c[3]); // a=b[0]*c[0]+...
void AVectorCopy(float a[3], float b[3]);           // a[0]=b[0]; ...
Von den FP-Funktionen benutzte Funktionen
int LMUL(int a, int b, int shift);                  // (a*b)>>shift
int FDIV(unsigned int a, unsigned int b);           // a/b
int FDIVS(int a, int b);                            // a/b
int FDIV64(int l, int h, int d);                    // (h*2^32+l)/d


Und zurück!


Wer mich mit elektronischer Post beglücken will, kombiniere die Bestandteile peter, peter-teichmann und de in sinnvoller Art und Weise, um eine Adresse zu erhalten.