티스토리 뷰
Maxima supports three types of numbers: exact fractions (which can be generated for example by typing 1/10), IEEE floating-point numbers (0.2) and arbitrary precision big floats (1b-1).
Note that, owing to their nature as binary (not decimal) numbers, there is for example no way to generate an IEEE floating-point number that exactly equals 0.1.
If floating-point numbers are used instead of fractions, Maxima will therefore sometimes have to introduce a (very small) error and use things like 3602879701896397/36028797018963968 for 0.1.
Tip of the day
Maxima는 정확한 분수(예를 들어 1/10을 입력하면 생성 가능), IEEE 부동 소수점 숫자(0.2), 임의의 정밀도 큰 부동 소수점(1b-1) 등 세 가지 유형의 숫자를 지원합니다.
부동 소수점은 10진수가 아닌 이진수라는 특성으로 인해 예를 들어 0.1과 정확히 일치하는 IEEE 부동 소수점 숫자를 생성할 수 있는 방법이 없습니다.
따라서 분수 대신 부동 소수점 숫자를 사용하는 경우 Maxima는 때때로 (아주 작은) 오류를 도입하여 0.1에 3602879701896397/36028797018963968과 같은 숫자를 사용해야 합니다.
궁금한 점
그런데 0.1을 표시하는데 왜 하필이면 3602879701896397/36028797018963968과 같은 숫자로 분수를 만들어야 할까?
이 분수를 엑셀에 입력하니 3602879701896390/36028797018963900으로 변해 버린다.
십진수 | 2진수 |
3602879701896397 | 1100110011001100110011001100110011001100110011001101 |
36028797018963968 | 10000000000000000000000000000000000000000000000000000000 |
https://steve.hollasch.net/cgindex/coding/ieeefloat.html
https://docs.python.org/3/tutorial/floatingpoint.html
https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
'Maxima' 카테고리의 다른 글
Simplify (0) | 2023.06.30 |
---|---|
% will be automatically inserted before the operator (0) | 2023.06.30 |
File (0) | 2023.06.29 |
% and %on (0) | 2023.06.29 |
fonts change (0) | 2023.06.28 |