Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fx_s2308
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
battle_C_5
fx_s2308
Commits
dae905b6
Commit
dae905b6
authored
4 years ago
by
Choi Jinyoung
Browse files
Options
Downloads
Patches
Plain Diff
update test.c
parent
ec7e7ac8
Branches
Branches containing commit
No related tags found
1 merge request
!7
update test.c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
fx_s2308_longlong.h
+1
-1
1 addition, 1 deletion
fx_s2308_longlong.h
test.c
+9
-4
9 additions, 4 deletions
test.c
with
10 additions
and
5 deletions
fx_s2308_longlong.h
+
1
−
1
View file @
dae905b6
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
#define fx_s2308_l_mul3(a,b) (int)(((a)*(b)) >> 8)
#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_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))
#define fx_s2308_l_div2(a,b) (int)((a<<8)/(b))
typedef
int
fx_s2308
;
typedef
int
fx_s2308
;
...
...
This diff is collapsed.
Click to expand it.
test.c
+
9
−
4
View file @
dae905b6
...
@@ -37,7 +37,7 @@ int main() {
...
@@ -37,7 +37,7 @@ int main() {
printf
(
"
\n
======STEP 2: fx_s2308 long long Test=======
\n
"
);
printf
(
"
\n
======STEP 2: fx_s2308 long long Test=======
\n
"
);
printf
(
"Please enter two double: "
);
printf
(
"Please enter two double: "
);
getchar
();
//
getchar();
double
da
;
double
da
;
double
db
;
double
db
;
scanf
(
"%lf %lf"
,
&
da
,
&
db
);
scanf
(
"%lf %lf"
,
&
da
,
&
db
);
...
@@ -59,12 +59,17 @@ int main() {
...
@@ -59,12 +59,17 @@ int main() {
printf
(
"
\n\t
====== Division =======
\n
"
);
printf
(
"
\n\t
====== Division =======
\n
"
);
fc
=
fx_s2308_l_div1
(
fa
,
fb
);
fc
=
fx_s2308_l_div1
(
fa
,
fb
);
printf
(
"
\n\
t\
t
div1: Exact answer = %f func result = %f, error = %f
\n
"
,
da
/
db
,
FX_TO_DOUBLE
(
fc
),
da
/
db
-
FX_TO_DOUBLE
(
fc
));
printf
(
"
\n\t
div1: 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
);
fc
=
fx_s2308_l_div2
(
fa
,
fb
);
printf
(
"
\n\t
div2: Exact answer = %f func result = %f, error = %f
\n
"
,
da
/
db
,
FX_TO_DOUBLE
(
fc
),
da
/
db
-
FX_TO_DOUBLE
(
fc
));
printf
(
"
\n\t
div2: 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
====== 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
))));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment