Skip to content
Snippets Groups Projects
Commit 372e47a0 authored by hansuchan's avatar hansuchan
Browse files

solved error

parent af9924e8
Branches
No related tags found
No related merge requests found
#pragma once #pragma once
typedef double fx_s2308; typedef double fx_s2308;
#define fx_to_double(a) ((double) a/ (256.0)) #define fx_to_double(a) ((double) a/ (256.0))
#define double_to_fix(a) ((double) a/ (256.0)) #define double_to_fx(a) ((int) (a* 256.0))
#define fx_add(a,b) (a+b) #define fx_add(a,b) (a+b)
#define fx_sub(a,b) (a-b) #define fx_sub(a,b) (a-b)
#define fx_mul(a,b) (double_to_fx(fx_to_double(a)*fx_to_double(b))) #define fx_mul(a,b) double_to_fx((fx_to_double(a)*fx_to_double(b)))
#define fx_div (a,b) (double_to_fx(fx_to_double(a)/fx_to_double(b))) #define fx_div(a,b) double_to_fx((fx_to_double(a)/fx_to_double(b)))
\ No newline at end of file \ No newline at end of file
...@@ -5,7 +5,7 @@ typedef double fx_s2308; ...@@ -5,7 +5,7 @@ typedef double fx_s2308;
int main() { int main() {
fx_s2308 a = 200; fx_s2308 a = 200;
fx_s2308 b = 100; fx_s2308 b = 100;
fx_s2308 output = fx_add(a, b); fx_s2308 output = fx_mul(a, b);
printf("%lf",output); printf("%lf",output);
return 0; return 0;
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment