Aloah
Mir war gerade langweilig, da Habe ich mir gedacht das ich jetzt ein möglichst plattformunabhängiges LIBC schreiben könnte.
(Ok, eigendlich ist es mir nicht langeweilig, aber ich hänge beim multitasking)
Also, Was haltet ihr davon, und wer möchte mitmachen?
<assert.h> <float.h> <math.h> <stdarg.h> <stdlib.h>
<ctype.h> <limits.h> <setjmp.h> <stddef.h> <string.h>
<errno.h> <locale.h> <signal.h< <stdio.h> <time.h>
Das sind alle STD includes, oder giebt es mehr??
Hier mein Beitrag:(math.h)
das steht natürlich nicht in math.h, sondern wird zu math.o kompiliert
die ganzen *.o dateien Bündeln wir dann mit ar (oder ld) zu einer *.a datei und fertig ist die Homemade LIBC.
MfG X-Mind
Changelog:
sqrt() wurde jetzt so verändert, das es nicht das Quadrat der Zahl, sondern die Quadratwurzel zurüchliefert (Danke XanClic)
Mir war gerade langweilig, da Habe ich mir gedacht das ich jetzt ein möglichst plattformunabhängiges LIBC schreiben könnte.
(Ok, eigendlich ist es mir nicht langeweilig, aber ich hänge beim multitasking)
Also, Was haltet ihr davon, und wer möchte mitmachen?
<assert.h> <float.h> <math.h> <stdarg.h> <stdlib.h>
<ctype.h> <limits.h> <setjmp.h> <stddef.h> <string.h>
<errno.h> <locale.h> <signal.h< <stdio.h> <time.h>
Das sind alle STD includes, oder giebt es mehr??
Hier mein Beitrag:(math.h)
Code: [Auswählen]
// double sin(double x)
// double cos(double x)
// double tan(double x)
double asin(double sina)
{
// sina = Sinus Alpha
double sinx;
sinx = sina / 360 * (2 * 3.14159265358979323846264338327950); // Pi mit 32 Nachkommastellen
return sinx; // Sinus x ist gleich sinus Alpha / 360 * 2 * PI
}
// double acos(double x)
// double atan(double x)
// double atan2(double x, double y)
// double sinh(double x)
// double cosh(double x)
// double tanh(double x)
// double exp(double x)
// double log(double x)
// double log10(double x)
// double pow(double x, double y)
double sqrt(double zahl)
{
double wurzel;
wurzel = (zahl * zahl);
return wurzel;
}
// double ceil(double x)
// double floor (double x)
double fabs(double x)
{
double abs;
if (x < 0)
{
abs = 2 * x;
}
else
{
return x;
}
return abs;
}
// double ldexp(double x,n)
// double frexp(double x, int *exp)
// double modf(double x, double *ip)
// double fmod(double x, double y)
das steht natürlich nicht in math.h, sondern wird zu math.o kompiliert
die ganzen *.o dateien Bündeln wir dann mit ar (oder ld) zu einer *.a datei und fertig ist die Homemade LIBC.
MfG X-Mind
Changelog:
sqrt() wurde jetzt so verändert, das es nicht das Quadrat der Zahl, sondern die Quadratwurzel zurüchliefert (Danke XanClic)

Übersicht
Wiki
Hilfe
Suche
Einloggen
Registrieren
Drucken
Gespeichert




