Mathematische Funktionen

Dieser Teil von ManderC ist noch in Bearbeitung. Vorerst muss man sich mit einer rudimentären Auflistung begnügen. Man beachte dass diese Einträge während der frühen Programmier-Jahre des Autors entstanden und (momentan noch) teilweise unkorrekt sein können.

stdlib.h

Einfache mathematische Funktionen:

int abs(int val)Betrag
long labs(long val)Betrag von longint
div_tdiv(int x, int y)Berechnung von x div y und x mod y
ldiv_t ldiv(long x, long y)Gleich wie div, aber mit long
int rand(void)Zufallszahl
void srand(unsigned int start)Festlegen der Generator-Basis

math.h

double sin(double ang)Sinus
double cos(double ang)Cosinus
double tan(double ang)Tangens
double asin(double val)Arcussinus
double acos(double val)Arcuscosinus
double atan(double val)Arcustangens
double atan2(double x, double y)Arcustangens von x/y
double sinh(double ang)Sinus Hyperbolicus
double cosh(double ang)Cosinus Hyperbolicus
double tanh(double ang)Tangens Hyperbolicus

Winkel werden stets in rad angegeben.

double sqrt(double val)Quadratwurzel
double pow(double bas, double exp)Power, Potenzierung: bas^exp
double exp(double val)Exponent
double ldexp(double val, int exp)val*2^exp
double fabs(double val)Betrag, Absolutwert
double ceil(double val)Aufrunden
double floor(double val)Abrunden
double fmod(double x, double y)x modulo y
double log(double val)log Basis e
double log10(double val)log Basis 10
double frexp(double val, int* exp)Mantisse und Exponent
double modf(double v1, double* v2)Ganzzahl und Dezimalbruch

Die Funktionen frexp und modf geben je zwei Werte zurück, wobei der zweite mittels Übergabe durch Pointer zurückgegeben wird.

rand:

RAND_MAX            0x7FFF     grösstmögliche Zufallszahl