How to compute arc cosine in C

3 Answers

0 votes
#include <stdio.h>
#include <math.h>

int main(void)
{
    double d = acos(-1);
    
    printf("%lf", d);
    
    return 0;
}



/*
run:

3.141593

*/

 



answered Jan 25, 2023 by avibootz
0 votes
#include <stdio.h>
#include <math.h>

int main(void)
{
    float f = acosf(0);
    
    printf("%f", f);

    return 0;
}



/*
run:

1.570796

*/

 



answered Jan 25, 2023 by avibootz
0 votes
#include <stdio.h>
#include <math.h>

int main(void)
{
    long double ld = acosf(0.5);
    
    printf("%Lf", ld);

    return 0;
}



/*
run:

1.047198

*/

 



answered Jan 25, 2023 by avibootz
edited Jan 25, 2023 by avibootz

Related questions

1 answer 183 views
2 answers 244 views
3 answers 165 views
165 views asked Jan 28, 2023 by avibootz
3 answers 114 views
114 views asked Jan 27, 2023 by avibootz
3 answers 163 views
163 views asked Jan 25, 2023 by avibootz
3 answers 128 views
128 views asked Jan 26, 2023 by avibootz
...