Two's Complement Binary Strings
Version 2.0.0.0 (4,32 ko) par
Drew Compston
Convert between binary fixed point two's complement strings and decimal numbers.
These functions convert between binary strings and decimal numbers like the built-in MATLAB functions BIN2DEC and DEC2BIN but can accommodate negative integers (via two's complement) and fractional positive and negative numbers (via two's complement fixed point with a binary point in the string).
Note that many fractional numbers that can be represented with a finite number of fractional digits cannot be represented by a finite number of fractional bits (specifically non-powers-of-two fractions like 0.3), which means that FIX2DEC will not always exactly invert DEC2FIX.
Citation pour cette source
Drew Compston (2026). Two's Complement Binary Strings (https://fr.mathworks.com/matlabcentral/fileexchange/38889-two-s-complement-binary-strings), MATLAB Central File Exchange. Extrait(e) le .
Compatibilité avec les versions de MATLAB
Créé avec
R2007b
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS LinuxCatégories
En savoir plus sur Characters and Strings dans Help Center et MATLAB Answers
Tags
Remerciements
A inspiré : DI-155 Acquisition V1.0
Découvrir Live Editor
Créez des scripts avec du code, des résultats et du texte formaté dans un même document exécutable.
| Version | Publié le | Notes de version | |
|---|---|---|---|
| 2.0.0.0 | Mathworks changed the behavior of bitcmp, so I made a new function bitcmpold that reflects the old behavior of the function. |
||
| 1.0.0.0 |
