부동소수점,floating_point

Floating-Point Arithmetic
abbr. FP
floating point number abbr. FPN

구성
거의 모두 IEEE 754를 따르는 듯. https://pub.mearie.org/ieee_754 WpEn:IEEE_754 Wiki:IeeeSevenFiftyFour https://oeis.org/wiki/IEEE_arithmetic
여기서
  • single precision floating point - 단정도 (정도는 정밀도를 줄인 말인가?)
  • double precision floating point - 배정도
기타 이런 게 있다. precision을 어떻게 할 것인가, 비트를 어떻게 분배할 것인가, 정확도(정밀도?)와 범위를 어떻게 절충할 것인가, 이런 문제? CHK
  • Google BFloat16 (exponent범위가 fp16보다 넓다)
  • NVIDIA TensorFloat
  • Automatic mixed precision (AMP)
  • Microsoft Binary Format (MBF) - historic
  • Minifloat
  • FP11 - historic (for PDP-11) https://gunkies.org/wiki/FP11_floating_point
see also https://medium.com/@moocaholic/fp64-fp32-fp16-bfloat16-tf32-and-other-members-of-the-zoo-a1ca7897d407

Rel
fpn은 정밀도,precision에 따라 크기가 제각각.
정확도,accuracy ...(이상 둘은 2023-12 현재 ML얘기만)
machine_epsilon

소수점 밑 첫째 자리가 0이 아닌 수가 나오도록 하는 것이 저장에 효율적 - 정규화,normalization
계산하는 장치는 FPU. floating_point_unit / floating-point_unit
부동소수점장치,floating-point_unit,FPU
{
floating point unit, FPU, 부동소수점장치

Compare:
ALU 산술논리장치 arithmetic_logic_unit WpKo:산술_논리_장치 WpEn:Arithmetic_logic_unit

Links:
https://wiki.osdev.org/FPU X86 FPU 관련 자료


}

연산 결과가 항상 참값이 아니며 근사,approximation값일 수 있음. 대개의 경우? CHK. 약간의 오차,error가 있을 때가 많음.
ex. 0.1 + 0.2 = 0.30000000000000004
https://0.30000000000000004.com/ (PL별 결과)
via: https://johngrib.github.io/blog/2017/08/23/0.30000000000000004/

따라서 비교,comparison 연산에 주의를 기울여야 한다, 특히 등호를 쓰는 ... (상등? 동등? equality? equivalence? equality_operator or equality_operation? rel: 동치관계,equivalence_relation? equals? 아무튼 C/C++ 유래 PL 문법에서 == and != 를 쓰는 그 연산) 을 할 때.
관련links tmp
{
https://everything2.com/title/floating-point comparison
아주 약간의 오차,error (machine_epsilon를 사용? - 작성중) 를 무시하는 식으로 - 약간의 차이가 있어도 같다고 - 해야 함.
}

그리고 마찬가지 이유로
오차의 전파? error_propagation? (uncertainty_propagation 작성중) - 에도 주의해야.

그리고 related links
Wiki:FloatingPointFractions

rel
구간산술,interval_arithmetic - 과 분명 겹치는 내용 있다
수치해석,numerical_analysis - 을 하기 위해선 컴퓨터가 수 다루는 방식에 대한 이해가 필수적이다

이것들에 대한 독립 pagename은 아마도 floating-point arithmetic ?
Ggl:부동소수점 산술
Ggl:floating point arithmetic
Naver:floating point arithmetic
rel? : 산술,arithmetic

정밀도에 따라

32bit float

single precision
1bit 부호, 0 양수 1 음수
8bit 지수부
나머지 가수부

64bit float

double precision
1bit 부호
11bit 지수
52bit 가수

부동소수점 수 FPN

여기서 다루는 수,number ... 페이지 커지면 이것도 아마 독립 필요 할수도 안할수도
부동소수점수,floating-point_number FPN
{
여기엔 다른 컴퓨터가 다루는 수 형식들을 비교하면 좋은? as coordinate terms ...제일 간단한 integer부터
Up: 수,number
}

floating point unit, FPU

이걸 처리하는 장치, 옛날에는 CPU 밖에 코프로세서,coprocessor로 별도로 있었고, 현재는 대체로 CPU 내에 통합되어 있는
GPGPU를 한다면 GPU에도 대량으로 존재하는 것을 이제 ML등 여러 용도로 많이 쓰는....


// Up: 장치,unit 만들까?

seealso

Not_a_number,NaN
수치해석,numerical_analysis
유리수,rational_number
점,point esp decimal_point 였나?? 암튼 기하학의 점 그런거 말고
포화산술,saturation_arithmetic 나중에

자바 책에서

float approximately 10-38 to 1038 7 significant digits
doubleapproximately 10-308 to 10308 15 significant digits

PL별 syntax: FP literal



Compare:
그냥 정수,integer, esp. 컴퓨터의 integer
고정소수점,fixed_point; curr goto p FixedPoint
{
floating point number/arithmetic(curr. 부동소수점,floating_point)과 비교하여 장단점
  • less flexible (당연히, 고정되어 있으므로) → 표현 가능 수 범위가 좁은.
  • ...또 뭐있지? 구현하기 간단한 거?

비트 배분 : 부호,sign,
fixed point : 부호 1 bit + 나머지 integer part - 두 부분으로 이루어짐. (소수점의 위치는 어딘가로 fixed)
floating point : 부호 1 bit + 유효숫자?를 나타내는 가수부(mantissa) + 소수점의 위치를 나타내는 지수부 - 세 부분으로 이루어짐.
비트 배열 순서는 보통 부호 | 지수부 | 가수부 순.
(cf. 보통 사람이 쓰는 표기 순서는 보통 부호 | 가수부 | 지수부 순.)

}
{
arbitrary-precision arithmetic, bignum arithmetic, multiple-precision arithmetic, infinite-precision arithmetic (wpen)

compare bigint.