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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
battle_C_5
fx_s2308
Commits
dd0e0de0
Commit
dd0e0de0
authored
4 years ago
by
hansuchan
Browse files
Options
Downloads
Patches
Plain Diff
update fx_s2308 readme
parent
88fbc1d3
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+61
-13
61 additions, 13 deletions
README.md
fx_s2308_double.h
+2
-2
2 additions, 2 deletions
fx_s2308_double.h
with
63 additions
and
15 deletions
README.md
+
61
−
13
View file @
dd0e0de0
...
...
@@ -8,26 +8,74 @@
| 3 | Han Suchan |
| 4 | Woo Nayoung |
## Fixed Point
-
고정소수점이란 소수점을 사용하여 고정된 자리의 소수를 나타내는 것이다. 한정된 메모리에서 부동소수점 방식보다 좁은 범위의 수만 나타낼 수 있다는 단점이 있다
-
장점으로는 부동소수점 자료형의 연산보다 빠르다
## Fixed Point Number - fx_s2308
*
sXXYY fixed point number
*
s: 부호 비트
*
XX: 소수점 위 비트 수 (정수부)
*
YY: 소수점 아래 비트 수 (소수부)

### 입력 값 범위
*
0 ~ 4294967296 (2^32-1)
*
s2308 fixed point number
*
s: 부호 비트
*
23: 소수점 위 비트 수 (정수부)
*
08: 소수점 아래 비트 수 (소수부)
*
정수부에 할당된 비트가 23보다 작은 team의 경우에는 fx_s2308보다 표현할수 있는 정수의 범위가 작고 소수부에 할당된 비트가 8비트보다 작은 team의 경우에는 fx_s2308보다 오차가 작다고 할 수 있다.
### minimum (최솟값)
*
-
2^23 (실수값
)
*
-
8388608 =-(2^31
)
### maximum (최댓값)
*
(2^23) - (2^(-8)) (실수값
)
*
8388607.99609375=((2^31)-1)/(2^8
)
### resolution (분해능)
*
2^(-8)
### list of functions
*
fx_sine
*
fx_sqrt
*
fx_pow
\ No newline at end of file
-
소수부 비트가 8비트 할당되어 있기 때문에 표현할 수 있는 가장작은 수는 2^(-8)=0.00390625
-
이 분해능 때문에 PI를 고정소수점 값에서 Real Value로 다시 변환하게 되면 오차가 발생하게 된다
## Library
### List of functions
| Datatype | Name | Parameters | Description |
| -------- | ------- | ------------------- | -------------------------------------------- |
| fx_s2308 | fx_sine | fx_s2308 a | fx_s2308로 표현된 a의 sin값을 반환한다 |
| fx_s2308 | fx_sqrt | fx_s2308 a | fx_s2308로 표현된 a의 값의 제곱근을 반환한다 |
| fx_s2308 | fx_pow | fx_s2308 a,double n | fx_s2308로 표현된 a의 n제곱의 값을 반환한다. |
### List of macros
| Macro | Description |
| --------------- | ------------------------------------------------------------ |
| FX_TO_DOUBLE(a) | fx_s2308 a의 값을 double형으로 형변환하기 위한 매크로 |
| FX_TO_FLOAT(a) | fx_s2308 a의 값을 float형으로 형변환하기 위한 매크로 |
| FX_TO_INT(a) | fx_s2308 a의 값을 int형으로 형변환하기 위한 매크로 |
| FX_TO_SHORT(a) | fx_s2308 a의 값을 short형으로 형변환하기 위한 매크로 |
| DOUBLE_TO_FX(a) | double a의 값을 fx_s2308로 형변환하기 위한 매크로 |
| FX_ADD(a,b) | fx_s2308 데이터 연산으로 a에 b의 값을 더하기 위한 매크로 |
| FX_SUB(a,b) | fx_s2308 데이터 연산으로 a에서 b의 값을 빼기 위한 매크로 |
| FX_MUL(a,b) | fx_s2308 데이터 연산으로 a에 b의 값을 곱하기 위한 매크로 |
| FX_DIV(a,b) | fx_s2308 데이터 연산으로 a를 b로 나누기 위한 매크로 |
| PI | math_library의 M_PI의 값을 호출해서 고정소수점으로 변환하게 될때의 부하를 줄이기위해 설정한 매크로 상수 |
| FX_PI | PI값을 고정소수점으로 변환한 매크로 상수 |
## Makefile
`make`
Makefile의 정의대로 실행
`clean`
object 파일들을 삭제한다
`dep`
자동 의존 관계 생성으로 타겟이 어느파일에 의존하고 있는지 표시해주는 역할을 한다.
## Reference
https://t1.daumcdn.net/cfile/tistory/99853D3A5C5190CE09
\ No newline at end of file
This diff is collapsed.
Click to expand it.
fx_s2308_double.h
+
2
−
2
View file @
dd0e0de0
...
...
@@ -9,8 +9,8 @@ typedef double fx_s2308;
#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_DIV(a,b) DOUBLE_TO_FX(FX_TO_DOUBLE(a)/FX_TO_DOUBLE(b))
#define FX_PI (
DOUBLE
_TO_FX(
M_
PI))
#define PI 3.141592
#define FX_PI (
INT
_TO_FX(PI))
fx_s2308
fx_sine
(
fx_s2308
a
);
fx_s2308
fx_sqrt
(
fx_s2308
a
);
...
...
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