Skip to content
Snippets Groups Projects
Commit 36b79619 authored by root's avatar root
Browse files

adding test.c

parent 0c34be4b
No related branches found
No related tags found
No related merge requests found
a.out 0 → 100644
File added
#define _CRT_SECURE_NO_WARNINGS
#include "fx_s4716_double.h"
#include "fx_s4716_longlong.h"
extern void fx_to_double(fx_s4716 a);
extern void double_to_fx(double a);
......@@ -20,6 +21,17 @@ int main()
int option;
int quit = 0;
printf("This is program to test fixed point arithmetic\n");
printf(" OPTION \n");
printf("1. double \n");
printf("2. longlong \n");
printf("0. quit \n\n");
printf("Type option : ");
fflush(stdout);
scanf("%d", &option);
if (option == 0) return 0;
else if(option == 1)
{
printf(" OPTION \n");
printf("0. add \n");
printf("1. subtract \n");
......@@ -96,9 +108,44 @@ int main()
break;
}
if (quit == 1) {
printf("Quit the program");
printf("Quit the program\n");
break;
}
}
}
else if(option == 2)
{
// temp before making c file
long long t, tt, ttt;
printf(" OPTION \n");
printf("1. multiply \n");
printf("2. division \n");
printf("0. quit\n\n");
while (1) {
printf("Type option : ");
fflush(stdout);
scanf("%d", &option);
switch(option) {
case 0 : return 0;
case 1 :
printf("Input two number : "); fflush(stdout);
scanf("%lld %lld", &a, &b);
t = fx_s4716_longlong_mul(a,b);
tt = fx_s4716_longlong_mul1(a,b);
ttt = fx_s4716_longlong_mul2(a,b);
printf("%lld %lld %lld\n", t, tt, ttt);
break;
case 2 :
printf("Input two number : "); fflush(stdout);
scanf("%lld %lld", &a, &b);
t = fx_s4716_longlong_div(a,b);
tt = fx_s4716_longlong_div1(a,b);
ttt = fx_s4716_longlong_div2(a,b);
printf("%lld %lld %lld\n", t, tt, ttt);
break;
}
}
}
}
\ 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