diff --git a/testing/README.md b/testing/README.md index 7e7a305e27949f3058a96bcca444cd3b415fa489..2fe8e84d826e8da3acba8e7949580b0950214749 100644 --- a/testing/README.md +++ b/testing/README.md @@ -25,8 +25,38 @@ - 2.1.1 list of fuctions - 2.1.1.1 stpe 1 - a. add - ~~~ - #define fx_add(a, b) ((a)+(b)) - ~~~ - - to add two fixed point numbers there is no need to conversion of data type - - just add two fixed point numbers and return result \ No newline at end of file + ~~~ + #define fx_add(a, b) ((a)+(b)) + ~~~ + - to add two fixed point numbers there is no need to conversion of data type + - just add two fixed point numbers and return result + - b. sub + ~~~ + #define fx_sub(a, b) ((a)-(b)) + ~~~ + - to sub one fixed point number from another fixed point number there is no need to conversion of data type. + - just operate function without conversion of data type and return result + - c. mul + ~~~ + #define fx_mul(a, b) double_to_fx(fx_to_double (a) * fx_to_double (b)) + ~~~ + - to mul two fixed pouint number shoul do type conversion + - first convert two fixed point number to double type and do mul operation + - second result calculated from first step should be converted to fixed point number(type conversion) + - d. div + ~~~ + #define fx_div(a, b) double_to_fx(fx_to_double (a) / fx_to_double (b)) + ~~~ + - to div two fixed pouint number shoul do type conversion + - first convert two fixed point number to double type and do div operation + - second result calculated from first step should be converted to fixed point number(type conversion) + - e. fixed -> double + ~~~ + #define fx_to_double(a) (a/P2_2to32) + ~~~ + - to convert fixed point to double should divide fixed point number by 2^32(s31(32)=>decimal part bits) + - f. double -> fixed + ~~~ + #define double_to_fx(a) (long long)(a*P2_2to32) + ~~~ + - to convert double to fixed point should multiply double number and 2^32(s31(32)=>decimal part bits) \ No newline at end of file