life icon indicating copy to clipboard operation
life copied to clipboard

Floating point operation is very inaccurate

Open elvin-du opened this issue 6 years ago • 0 comments

` C standard library referenced by POW function < math. H >,result as follows:

double ww = pow(3.0, 0.3) = 1.1293469354568555
double xx = pow(2.2, 0.3) = 1.029005759421095 float yy = powf(2, 0.3) = 1.2311444 float yy = powf(2.4, 0.3) = 1.3003594 long double zz = powl(2, 0.3) = 1 long double mm = powl(2.3, 0.3) = 1.04282000071553305 double aa = pow(1.12, 0.5) = 1.0583005244258363

result using Calculator as follows:

pow(3.0, 0.3) = 1.3903891703159093404852542946161 pow(2.2, 0.3) = 1.2668546920110241257762468650659 powf(2, 0.3) = 1.2311444133449162844993930691677 powf(2.4, 0.3) = 1.3003593134073364931694839670248‬ powl(2, 0.3) = 1.2311444133449162844993930691677 powl(2.3, 0.3) = 1.2838620180052701355554021438659‬ pow(1.12, 0.5) = 1.0583005244258362362006463014557 `

elvin-du avatar Dec 19 '19 08:12 elvin-du