floating point - Precision of calculations after exponent function -


i have question regarding precision of calculations - more of mathematical theory behind programming.

i have given float number x , rounding of number, accurate 10^(-n) decimal place: x'. now, know, if after calculating exponent function: y=2^(x) difference between number , rounded number stay on same level of precision. mean:

|2^(x)-2^(x')| @ level of 10^(-n-1)

exponentiation magnifies relative error and, extension, ulp error. consider illustrative example:

float x = 0x1.fffffep6; printf ("x=%a %15.8e  exp2(x)=%a %15.8e\n", x, x, exp2f (x), exp2f(x)); x = nextafterf (x, 0.0f); printf ("x=%a %15.8e  exp2(x)=%a %15.8e\n", x, x, exp2f (x), exp2f(x)); 

this print like

x=0x1.fffffep+6 1.27999992e+02  exp2(x)=0x1.ffff4ep+127 3.40280562e+38 x=0x1.fffffcp+6 1.27999985e+02  exp2(x)=0x1.fffe9ep+127 3.40278777e+38 

the maximum ulp error in result on same order of magnitude 2exponent bits of floating format used. in particular example, there 8 exponent bits in ieee-754 float, , 1 ulp difference in input translates 176 ulp difference in result. relative difference in arguments 5.5e-8, while relative difference in results 5.3e-6.

a simplified, intuitive, way of thinking magnification out of finite number of bits in significand / mantissa of floating-point argument, contribute magnitude, exponent bits, of result (in example, these bits representing integral portion of 127), while remaining bits contribute significand / mantissa bits of result.

if @ mathematically, if original argument x = n*(1+ε), ex = en*(1+ε) = en * en*ε ≈ en * (1+n*ε). if n ≈ 128, ε ≈ 1e-7, expected maximum relative error around 1.28e-5.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -