Question: In the C program, What is the difference between the functions in the math library(math.h) and those defined by yourself? Eg: We can define math.h

In the C program, What is the difference between the functions in the math library(math.h) and those defined by yourself?

Eg:

We can define math.h and use sin(x) cos(x)

Also, we can define sin(x) cos(x) by ourself which ls like

double Sin(double X) { double Result=X,Fac=1.0,Xn=X,Precious=X; int n=1,sign=1; while(Precious>1e-6) { n++; Fac=Fac*n*(++n); Xn*=X*X; sign=-sign; Precious=Xn/Fac; Result=sign>0?Result+Precious:Result-Precious; } return Result; }

So, I noticed the output is exact the same, but if there are some parts still differences between them.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!