부동소수점,floating_point

부동소수점,floating_point (rev. 1.56)

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
see also https://medium.com/@moocaholic/fp64-fp32-fp16-bfloat16-tf32-and-other-members-of-the-zoo-a1ca7897d407

Rel
정밀도,precision
정확도,accuracy ...(이상 둘은 2023-12 현재 ML얘기만)
machine_epsilon

소수점 밑 첫째 자리가 0이 아닌 수가 나오도록 하는 것이 저장에 효율적 - 정규화,normalization

계산하는 장치는 FPU. floating_point_unit / floating-point_unit
{
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 가수

floating point unit, FPU

이걸 처리하는 장치, 대체로 CPU 내에 통합되어 있는


자바 책에서

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