From dae905b69f7f272bd54f706c1e64eb45bd42e98d Mon Sep 17 00:00:00 2001
From: Choi Jinyoung <bmdj123@ajou.ac.kr>
Date: Wed, 19 Aug 2020 22:11:04 +0900
Subject: [PATCH] update test.c

---
 fx_s2308_longlong.h |  2 +-
 test.c              | 13 +++++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/fx_s2308_longlong.h b/fx_s2308_longlong.h
index 39ae85a..0a10dcb 100644
--- a/fx_s2308_longlong.h
+++ b/fx_s2308_longlong.h
@@ -7,7 +7,7 @@
 #define fx_s2308_l_mul3(a,b) (int)(((a)*(b)) >> 8) 
 #define fx_s2308_l_mul4(a,b) (int)(((a>>4)*(b>>4))) 
 
-#define fx_s2308_l_div1(a,b) (int)((long long)(a)/(b)) 
+#define fx_s2308_l_div1(a,b) (int)(((long long)(a)/(b))<<8) 
 #define fx_s2308_l_div2(a,b) (int)((a<<8)/(b)) 
 
 typedef int fx_s2308;
diff --git a/test.c b/test.c
index 7c48c39..5a2477a 100644
--- a/test.c
+++ b/test.c
@@ -37,11 +37,11 @@ int main() {
 
 	printf("\n======STEP 2: fx_s2308 long long Test=======\n");
 	printf("Please enter two double: ");
-	getchar();
+	// getchar();
     double da;
     double db;
     scanf("%lf %lf", &da, &db);
-
+	
     fx_s2308 fa,fb,fc;
 
     fa=DOUBLE_TO_FX(da);
@@ -59,12 +59,17 @@ int main() {
 
 	printf("\n\t====== Division =======\n");
 	fc=fx_s2308_l_div1(fa,fb);
-	printf("\n\t\tdiv1: Exact answer = %f func result = %f, error = %f\n",da/db, FX_TO_DOUBLE(fc), da/db-FX_TO_DOUBLE(fc));
+	printf("\n\tdiv1: Exact answer = %f func result = %f, error = %f\n",da/db, FX_TO_DOUBLE(fc), da/db-FX_TO_DOUBLE(fc));
 	fc=fx_s2308_l_div2(fa,fb);
 	printf("\n\tdiv2: Exact answer = %f func result = %f, error = %f\n",da/db, FX_TO_DOUBLE(fc), da/db-FX_TO_DOUBLE(fc));
 
 	printf("\n\t====== Sine =======\n");
-	printf("\n\t fx_s2308 long long sine 30 = %lf", FX_TO_DOUBLE(fx_s2308_sind(DOUBLE_TO_FX(30))));
+	printf("\n\t fx_s2308 long long sine 30 = %lf\n", FX_TO_DOUBLE(fx_s2308_sind(DOUBLE_TO_FX(30))));
+	printf("\n\t fx_s2308 long long sine -30 = %lf\n", FX_TO_DOUBLE(fx_s2308_sind(DOUBLE_TO_FX(-30))));
+	printf("\n\t fx_s2308 long long sine 190 = %lf\n", FX_TO_DOUBLE(fx_s2308_sind(DOUBLE_TO_FX(210))));
+
+
+
 
 
 
-- 
GitLab