From d78feb3dc84f8182526d525b097165d043e3ee06 Mon Sep 17 00:00:00 2001 From: baewoojin <dnwls514@ajou.ac.kr> Date: Thu, 20 Aug 2020 16:12:57 +0900 Subject: [PATCH] Update README.md --- testing/README.md | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/testing/README.md b/testing/README.md index 7e7a305..2fe8e84 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 -- GitLab