There is a function that calculates the value of a mathematical function by expanding it into a Taylor series. A university professor said that it was better not to divide by factorial, but to do something different. How can you optimize this function to remove factorial from the denominator?
double function(const double x) { int n=0,i; long long int factor; double eps=0.0001,F=eps+1.0, Sum=0; while(eps <= F)//ΠΡΠ»ΠΈ ΠΌΠΎΠ΄ΡΠ»Ρ Π·Π½Π°ΡΠ΅Π½ΠΈΡ ΡΡΠ½ΠΊΡΠΈΠΈ ΠΌΠ΅Π½ΡΡΠ΅ ΡΠ΅ΠΌ eps, ΠΏΡΠ΅ΠΊΡΠ°ΡΠ°Π΅ΠΌ ΡΡΠΌΠΌΠΈΡΠΎΠ²Π°Π½ΠΈΠ΅ { for(i=2,factor=1;i<=n;i++) factor*=i; F=(pow(-1,n) * pow(x,n)) / factor; Sum+=F; if(F<0)//Π£Π·Π½Π°Π΅ΠΌ ΠΌΠΎΠ΄ΡΠ»Ρ "F", Π΄Π»Ρ ΡΡΠ°Π²Π½ΠΈΠ²Π°Π½ΠΈΡ Ρ "eps" ΠΈΠ±ΠΎ Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅ ΠΌΠΎΠΆΠ΅Ρ Π±ΡΡΡ ΠΎΡΡΠΈΡΠ°ΡΠ΅Π»ΡΠ½ΡΠΌ. F*=-1; n++; } return Sum; } 


