Unlimited Decimal/Fractional Binary Converter

버전 1.0.0 (7.46 KB) 작성자: Patrik Forssén
Conversion to and from a decimal number and a fractional binary number. No limitations on order of magnitude/number of significant digits.
다운로드 수: 5
업데이트 날짜: 2022/11/19

라이선스 보기

Conversion to and from a decimal number and a fractional binary number. No limitations on order of magnitude and number of significant digits when the decimal number is supplied as a string. You may optionally set the number of significant bits returned or used in conversion. Requires Java.
Example:
% Make a negative number with 250 significant digits and 150 decimal places
decStr = ['-', regexprep([num2str(randi([0 9], 1, 100)), '.', ...
num2str(randi([0 9], 1, 150))], ' ', '')]
% Get the fractional binary number
binStr = dec2fbin(decStr)
% Convert the binary number back to a decimal number
fbin2dec(binStr)
% A double has 53 significant bits, convert with this limitation
fbin2dec(binStr, 53)
% Compare with MATLAB
str2double(decStr)

인용 양식

Patrik Forssén (2024). Unlimited Decimal/Fractional Binary Converter (https://www.mathworks.com/matlabcentral/fileexchange/120878-unlimited-decimal-fractional-binary-converter), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2020a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Decimal-Binary Converter Version 1.0

버전 게시됨 릴리스 정보
1.0.0