➖ 十进制转负二进制(负二进制编码)Encode Negative Binary
把十进制整数(正数、负数或 0)编码成负二进制(以 −2 为底的进位制),每行一个或用空格分隔,支持任意大的整数;可显示“输入 → 结果”对照、各位权重展开式(如 7 = 16 − 8 − 2 + 1),也能设置最少位数补 0。适合学习数制、做编程题和验证算法,数据在本地处理。Encode decimal integers (positive, negative or zero) as negabinary, the base −2 number system. One value per line or separated by spaces, integers of any size. Show an input → result table or the place-value expansion (e.g. 7 = 16 − 8 − 2 + 1), and pad to a minimum width. Handy for learning number systems, programming puzzles and checking algorithms. Processed locally.
使用说明与常见问题How-to & FAQ
「十进制转负二进制(负二进制编码)」是什么?What is the Encode Negative Binary tool?
把十进制整数(正数、负数或 0)编码成负二进制(以 −2 为底的进位制),每行一个或用空格分隔,支持任意大的整数;可显示“输入 → 结果”对照、各位权重展开式(如 7 = 16 − 8 − 2 + 1),也能设置最少位数补 0。适合学习数制、做编程题和验证算法,数据在本地处理。Encode decimal integers (positive, negative or zero) as negabinary, the base −2 number system. One value per line or separated by spaces, integers of any size. Show an input → result table or the place-value expansion (e.g. 7 = 16 − 8 − 2 + 1), and pad to a minimum width. Handy for learning number systems, programming puzzles and checking algorithms. Processed locally.
如何使用「十进制转负二进制(负二进制编码)」?How do I use the Encode Negative Binary tool?
在「十进制转负二进制(负二进制编码)」中,把内容粘贴或输入到上方输入框,按需设置「最少位数(可选)」,结果会实时显示在下方,点击「复制结果」即可复制。例如输入「3 -3」,得到「111 1101」。In the Encode Negative Binary: Paste or type into the input box, adjust "Minimum width (optional)"; the result appears below instantly — click "Copy result" to copy it. Example: "3 -3" → "111 1101".
什么是负二进制(negabinary)?What is negabinary?
负二进制是以 −2 为底数的进位制:从右往左各位的权重是 1、−2、4、−8、16……例如 11011 = 16 − 8 + 0 − 2 + 1 = 7。它不需要负号就能表示所有正负整数,例如 −1 写成 11、−2 写成 10。Negabinary is base −2: from the right the place values are 1, −2, 4, −8, 16 and so on, so 11011 = 16 − 8 + 0 − 2 + 1 = 7. It writes every positive and negative integer without a minus sign: −1 is 11 and −2 is 10.
怎样验证结果?How can I check a result?
勾选“显示权重展开式”,工具会把结果里每个 1 对应的权重列出来(1、−2、4、−8……),相加应等于原来的十进制数;也可以把结果粘贴到“负二进制解码”工具里反算。Tick Show the place values to list the weight of every 1 in the result (1, −2, 4, −8 …); they add up to the original number. You can also paste the result into Decode Negative Binary to convert it back.
有大小限制吗?Is there a size limit?
没有,用的是任意精度整数,几十位甚至上百位的十进制整数也能精确转换。只接受整数,小数会提示错误。No; arbitrary-precision integers are used, so integers with dozens or hundreds of digits convert exactly. Only whole numbers are accepted — decimals give an error.
计算精度如何?How precise are the results?
「十进制转负二进制(负二进制编码)」使用 JavaScript 双精度浮点数(约 15–16 位有效数字),部分功能使用 BigInt 处理大整数。The Encode Negative Binary uses double-precision floating point (about 15–16 significant digits); some features use BigInt for large integers.
「十进制转负二进制(负二进制编码)」免费吗?需要注册吗?Is the Encode Negative Binary free? Do I need an account?
「十进制转负二进制(负二进制编码)」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The Encode Negative Binary is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.