⊙ 二进制 XNOR 运算(同或)XNOR Binary Values
把两个或多个二进制数按位做 XNOR(同或)运算:先按位 XOR,再全部取反,两个数在该位相同时结果为 1,不同时为 0;多个数时,该位上 1 的个数为偶数结果就是 1。可以每行一组分别计算或所有数一起计算,位数不同时右端对齐左边补 0,可设置最少位数、显示竖式和十进制结果。适合学习逻辑门、比较两个二进制数哪些位相同和数字电路练习,数据在本地处理。Apply bitwise XNOR to two or more binary values: XOR them and invert the result, so with two values a bit is 1 where they match and 0 where they differ; with more values it is 1 where an even number of them have a 1. Work each line separately or combine all values; different lengths are right-aligned with leading zeros. Set a minimum width, show the working and see the result in decimal. Handy for learning logic gates, finding which bits of two values agree and digital-logic exercises. Processed locally.
使用说明与常见问题How-to & FAQ
「二进制 XNOR 运算(同或)」是什么?What is the XNOR Binary Values tool?
把两个或多个二进制数按位做 XNOR(同或)运算:先按位 XOR,再全部取反,两个数在该位相同时结果为 1,不同时为 0;多个数时,该位上 1 的个数为偶数结果就是 1。可以每行一组分别计算或所有数一起计算,位数不同时右端对齐左边补 0,可设置最少位数、显示竖式和十进制结果。适合学习逻辑门、比较两个二进制数哪些位相同和数字电路练习,数据在本地处理。Apply bitwise XNOR to two or more binary values: XOR them and invert the result, so with two values a bit is 1 where they match and 0 where they differ; with more values it is 1 where an even number of them have a 1. Work each line separately or combine all values; different lengths are right-aligned with leading zeros. Set a minimum width, show the working and see the result in decimal. Handy for learning logic gates, finding which bits of two values agree and digital-logic exercises. Processed locally.
如何使用「二进制 XNOR 运算(同或)」?How do I use the XNOR Binary Values tool?
在「二进制 XNOR 运算(同或)」中,把内容粘贴或输入到上方输入框,按需设置「计算方式」、「位数不同时」、「最少位数(可选)」,结果会实时显示在下方,点击「复制结果」即可复制。In the XNOR Binary Values: Paste or type into the input box, adjust "Combine", "Different lengths", "Minimum width (optional)"; the result appears below instantly — click "Copy result" to copy it.
怎样输入多个数?How do I enter several values?
每行一个数,或在同一行里用空格、逗号、分号或加号(+)分隔;可以带 0b 前缀,数中间的下划线会被忽略(如 1010_1100)。“自动”方式下:如果有一行包含两个以上的数,就每行单独计算;否则所有数一起计算。Put one value per line, or separate them with spaces, commas, semicolons or plus signs (+) on a line. A 0b prefix is fine and underscores inside a value are ignored (1010_1100). In Auto mode, if any line holds two or more values each line is worked out on its own; otherwise all values are combined.
位数不同的数怎么对齐?How are values of different lengths lined up?
按右端(最低位)对齐,短的数在左边补 0,例如 101 和 11 按 101 和 011 计算,结果的位数等于最长的数(或你设置的“最少位数”)。如果希望位数不同时报错,把“位数不同时”改为“报错”。They are right-aligned on the lowest bit and shorter values get leading zeros, so 101 and 11 are treated as 101 and 011; the result is as long as the longest value (or the Minimum width you set). Choose "Show an error" under Different lengths if mismatched lengths should be rejected.
XNOR 的真值表是什么?What is the XNOR truth table?
0 XNOR 0 = 1,0 XNOR 1 = 0,1 XNOR 0 = 0,1 XNOR 1 = 1:相同为 1、不同为 0,也就是 XOR 的结果取反,所以 XNOR 也叫“同或”或“相等门”。多个数做 XNOR 时,按“先全部 XOR、再取反”计算:该位上 1 的个数为偶数时结果为 1。0 XNOR 0 = 1, 0 XNOR 1 = 0, 1 XNOR 0 = 0, 1 XNOR 1 = 1 — the same gives 1, different gives 0, the inverse of XOR, which is why XNOR is called the equivalence gate. With several values the tool XORs them all and inverts the result, so a bit is 1 where an even number of them have a 1.
输入和输出是什么样的?What does the input and output look like?
例如在「二进制 XNOR 运算(同或)」中输入 1100 ⏎ 1010,输出为:1001(⏎ 表示换行)。For example, the XNOR Binary Values turns the input 1100 ⏎ 1010 into: 1001 (⏎ marks a line break).
有哪些选项可以调整?What options can I adjust?
「二进制 XNOR 运算(同或)」的设置:「计算方式」可选 自动、所有数一起计算、每行单独计算(默认 自动);「位数不同时」可选 左边补 0、报错(默认 左边补 0);「最少位数(可选)」可留空;可勾选:「显示竖式」、「同时显示十进制」、「同时显示十六进制」、「加 0b 前缀」、「每 4 位加空格」。改动任一选项后结果会按新设置重新生成。Settings in the XNOR Binary Values — "Combine": Auto, All values together, Each line separately (default Auto); "Different lengths": Pad with zeros on the left, Show an error (default Pad with zeros on the left); "Minimum width (optional)" optional; tick boxes: "Show the working", "Also show decimal", "Also show hex", "Add 0b prefix", "Space every 4 bits". Changing any option regenerates the result with the new setting.
代码或数据会被上传吗?Is my code or data uploaded?
不会。「二进制 XNOR 运算(同或)」完全用 JavaScript 在本地运行,适合处理含有密钥、内部接口等敏感内容的数据。No. The XNOR Binary Values runs entirely in local JavaScript, so it is safe for data containing keys or internal endpoints.
「二进制 XNOR 运算(同或)」免费吗?需要注册吗?Is the XNOR Binary Values free? Do I need an account?
「二进制 XNOR 运算(同或)」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The XNOR Binary Values is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.