Created
August 16, 2018 14:10
-
-
Save DemianD/c2a6f9c034da72d9816aa21aa989ef18 to your computer and use it in GitHub Desktop.
mijn_sinus.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <math.h> | |
#include <stdio.h> | |
float mijn_sinus(float radials) { | |
int i = 3; | |
float teller = radials; | |
int noemer = 1; | |
float som = teller / noemer; | |
while(fabs(teller/noemer) > 0.00001) { | |
teller = teller * radials * radials * -1; | |
noemer = i * (i-1) * noemer; | |
som += teller / noemer; | |
i += 2; | |
} | |
return som; | |
} | |
int main() { | |
printf("%f \n", sin(2)); | |
printf("%f \n", mijn_sinus(2)); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment