求圆周率的一行代码看不懂,求教!r=(i%4==1)?r+f:r-f;是神马意思?
#include
usingnamespacestd;
doublearctan(doublex)
{
doublesqr=x*x;
doublee=x;
doubler=0;
inti=1;
while(e/i>1e-15)
{
doublef=e/i;
r=(i%4==1)?r+f:r-f;
e=e*sqr;
i+=2;
}
returnr;
}
intmain()
{
doublea=16.0*arctan(1/5.0);
doubleb=4.0*arctan(1/239.0);
cout