🔍

首页Home › 数学工具Math

🔄 二进制转负二进制(base −2)Convert Binary to Negabinary

把普通二进制数(可以带负号)转换成负二进制(以 −2 为底的进位制):每行一个或用空格分隔,支持任意位数;可同时显示十进制值,或显示“输入 → 结果”对照。负二进制不需要负号就能表示负数,常见于编程题和数制练习,数据在本地处理。Convert ordinary binary numbers (a minus sign is allowed) into negabinary, the base −2 number system. One value per line or separated by spaces, any length. Optionally show the decimal value or an input → result table. Negabinary writes negative numbers without a sign and turns up in programming puzzles and number-system exercises. Processed locally.

使用说明与常见问题How-to & FAQ

「二进制转负二进制(base −2)」是什么?What is the Convert Binary to Negabinary tool?

把普通二进制数(可以带负号)转换成负二进制(以 −2 为底的进位制):每行一个或用空格分隔,支持任意位数;可同时显示十进制值,或显示“输入 → 结果”对照。负二进制不需要负号就能表示负数,常见于编程题和数制练习,数据在本地处理。Convert ordinary binary numbers (a minus sign is allowed) into negabinary, the base −2 number system. One value per line or separated by spaces, any length. Optionally show the decimal value or an input → result table. Negabinary writes negative numbers without a sign and turns up in programming puzzles and number-system exercises. Processed locally.

如何使用「二进制转负二进制(base −2)」?How do I use the Convert Binary to Negabinary tool?

在「二进制转负二进制(base −2)」中,把内容粘贴或输入到上方输入框,结果会实时显示在下方,点击「复制结果」即可复制。例如输入「111 -1」,得到「11011 11」。In the Convert Binary to Negabinary: Paste or type into the input box; the result appears below instantly — click "Copy result" to copy it. Example: "111 -1" → "11011 11".

什么是负二进制(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 do I convert by hand?

反复除以 −2,并让余数保持为 0 或 1:余数为负时把余数加 2、商加 1。把余数从下往上读就是结果。例如 7:7 ÷ −2 = −3 余 1,−3 ÷ −2 = 2 余 1,2 ÷ −2 = −1 余 0,−1 ÷ −2 = 1 余 1,1 ÷ −2 = 0 余 1,得 11011。Divide by −2 repeatedly, keeping each remainder 0 or 1 (if a remainder comes out negative, add 2 to it and 1 to the quotient). Read the remainders from bottom to top. For 7: 7 ÷ −2 = −3 r 1, −3 ÷ −2 = 2 r 1, 2 ÷ −2 = −1 r 0, −1 ÷ −2 = 1 r 1, 1 ÷ −2 = 0 r 1, giving 11011.

输入的负数怎么写?How do I enter a negative number?

在二进制数前面加 - 号,例如 -101 表示 −5,转换结果是 1111。负二进制本身没有负号。Put a minus sign in front of the binary number: -101 means −5 and converts to 1111. Negabinary itself never needs a sign.

计算精度如何?How precise are the results?

全程用 BigInt 任意精度整数,不是双精度浮点,所以很长的二进制转换也完全精确。Conversion uses BigInt (arbitrary-precision integers), not double-precision floats, so long binary values convert exactly.

输入和输出是什么样的?What does the input and output look like?

例如在「二进制转负二进制(base −2)」中输入 111 ⏎ -1 ⏎ 10,输出为:11011 ⏎ 11 ⏎ 110(⏎ 表示换行)。For example, the Convert Binary to Negabinary turns the input 111 ⏎ -1 ⏎ 10 into: 11011 ⏎ 11 ⏎ 110 (⏎ marks a line break).

有哪些选项可以调整?What options can I adjust?

「二进制转负二进制(base −2)」的设置:可勾选:「显示“输入 → 结果”」、「显示十进制」。改动任一选项后结果会按新设置重新生成。Settings in the Convert Binary to Negabinary — tick boxes: "Show input → result", "Show decimal". Changing any option regenerates the result with the new setting.

「二进制转负二进制(base −2)」免费吗?需要注册吗?Is the Convert Binary to Negabinary free? Do I need an account?

「二进制转负二进制(base −2)」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The Convert Binary to Negabinary is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.

相关工具Related tools

🔢 负二进制解码(base −2 转十进制)Decode Negative Binary➖ 十进制转负二进制(负二进制编码)Encode Negative Binary➖ 二进制减法计算器(带借位竖式)Subtract Binary Numbers➕ 十六进制加法计算器Add Hex Numbers✖️ 十六进制乘法计算器Multiply Hex Numbers🏛 十六进制转罗马数字Convert Hex to Roman Numeral🏛 罗马数字转十六进制Convert Roman Numeral to Hex📊 整数分析(个数、求和、平均、奇偶等)Analyze Integers± 更改整数正负号Change Integer Sign🔄 整数转回文数Convert Integer to Palindrome🔤 整数转英文 / 中文读法Convert Integers to Words🔢 英文 / 中文数字词转整数Convert Words to Integers

← 全部工具All tools