Skip to content
Snippets Groups Projects
Commit fad6082b authored by Sangbaek Lee's avatar Sangbaek Lee
Browse files

test fx

parent 98c2dbee
No related branches found
No related tags found
No related merge requests found
......@@ -40,3 +40,7 @@ void fx_pow(fx_s4716 a){
double power=FX_S4716_DOUBLE_POW(a);
printf("fx pow : %.16lf\n",power);
}
void fx_sine(fx_s4716 a){
double sine=FX_S4716_DOUBLE_SINE(a);
printf("fx sine : %.16lf\n",sine);
}
......@@ -33,3 +33,4 @@ typedef long long fx_s4716;
#define FX_INV_PI (DOUBLE_TO_FX(1/(M_PI)))
#define FX_S4716_DOUBLE_SQRT(a) ((sqrt(a))/(F_POWER_2_8))
#define FX_S4716_DOUBLE_POW(a) ((pow((double)a, 2.0))*(F_POWER_2_16))
#define FX_S4716_DOUBLE_SINE(a) (sin(a))
No preview for this file type
......@@ -11,6 +11,7 @@ extern void fx_pi();
extern void fx_inv_pi();
extern void fx_sqrt(fx_s4716 a);
extern void fx_pow(fx_s4716 a);
extern void fx_sine(fx_s4716 a);
int main()
{
......@@ -29,7 +30,8 @@ int main()
printf("7. print inverse PI \n");
printf("8. fix to double \n");
printf("9. double to fix \n");
printf("10. quit\n\n");
printf("10 get sine value \n");
printf("11. quit\n\n");
printf("Type option : ");
fflush(stdout);
......@@ -82,6 +84,10 @@ int main()
scanf("%lf",&c);
double_to_fx(c);
break;
case 10:
printf("Input one number : "); fflush(stdout);
scanf("%lld", &a);
fx_sine(a);
default:
break;
}
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment