Jump to content

Talk:Negative base

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Polish computers

[edit]

The main page used to claim "Negabinary was first implemented in computer hardware in the experimental Polish computers SKRZAT 1 and BINEG in 1950." I found an article (Marczynski, R W, "The First Seven Years of Polish Computing" IEEE Annals of the History of Computing, Vol 2, No 1, January 1980), which claims that the first Polish computer was begun in 1953, that BINEG was built in 1957-69, and which makes no mention of SKRZAT. Therefore I altered the date and removed SKRZAT. If anyone has any evidence that SKRZAT exists (I can't find any) they can re-edit. —Preceding unsigned comment added by Maltelauridsbrigge (talkcontribs) 12:19, 6 August 2008 (UTC)[reply]

Intercal notation

[edit]

Who ever said wikipedia editors have no sense of humour? --Sigmundur (talk) 17:05, 10 January 2010 (UTC)[reply]

Addition

[edit]

I have trouble understanding the alternate addition method for negabinary. The way I understand 1 + 1 causes a carry on position n+1 and an extra carry (higher row) on position n+2. It seems 1+1+1 is nearly identical except the result bit is 1 on that position. But the 3rd column from left ? 1+1+1+1. That's 4, which is 100 in negabinary. Does that mean a carry (lower row ? higher row ?) is propagated to position n+3 ? --89.73.166.93 (talk) 15:30, 13 November 2017 (UTC)[reply]

I found it confusing to find the leftmost carried value in the "carry" row when the rest of the example put such values in the "extra carry" row. I've moved it (https://wiki.riteme.site/w/index.php?title=Negative_base&oldid=1167324670). Johntobey (talk) 02:37, 27 July 2023 (UTC)[reply]

Subtraction

[edit]

"To negate a number, compute 0 minus the number." The purport of the preceding paragraph is, "to compute 0 minus a number, negate the number". —Preceding unsigned comment added by 83.87.70.180 (talk) 10:30, 14 January 2011 (UTC)[reply]

OK, what...

[edit]

"based on ideæ from..." ...ideæ? Ideæ?!

Surely the word is "ideas". AYFKM... 87.113.138.192 (talk) 23:05, 24 May 2014 (UTC)[reply]

If it's Latin (and I have a sneaking suspicion it might be Greek) I reckon ablative (locative or instrumental) ideīs would be better than nominative ideæ. :P —Tamfang (talk) 03:42, 25 May 2014 (UTC)[reply]

debates belong here

[edit]

Sbasson, I think you'll find that -3 × 2 + 1 = -5; from which it follows that floor(-5/-3) is 2, and the remainder is 1. (Remember that for the present purpose the remainder must be nonnegative.) If you disagree with this arithmetic, please explain here, rather than cluttering up the article. —Tamfang (talk) 08:27, 1 June 2014 (UTC)[reply]

er, no, floor(-5/-3) = floor(5/3) = 1; we need a different function here. —Tamfang (talk) 17:39, 3 February 2015 (UTC)[reply]

Tamfang, apologies for clutering the article, only saw this talk section today. I disagree, because 5/3 is equal to 1 remainder 2 (thirds) To test: 1 and 2 thirds equals 5/3 — Preceding unsigned comment added by 101.119.15.202 (talk) 06:51, 2 June 2014 (UTC)[reply]

Tamfang, ok, now I see where you are coming from (bc+d=a), apologies again for cluttering the article — Preceding unsigned comment added by Sbasson (talkcontribs) 07:49, 2 June 2014 (UTC)[reply]

The part is still wrong, see wolframalpha: http://www.wolframalpha.com/input/?i=146+in+base+-3 the example should probably be corrected — Preceding unsigned comment added by 130.89.139.48 (talk) 13:20, 3 February 2015 (UTC)[reply]

Negative-base results from WolframAlpha are nonsense and should be ignored. For example, https://www.wolframalpha.com/input/?i=1+in+base+-2 returns the answer "101.0101010101010..._(-2)", which is actually equal to 513; the correct answer is obviously "1_(-2)". — Jeff Erickson (talk) 21:18, 20 January 2020 (UTC)[reply]

Trolling doesn't belong in Wikipedia

[edit]

So will it be safe for me to get rid of the ridiculous, irrelevant INTERCAL reference? Nobody will understand it except people who already get the joke. Wikipedia is not supposed to be for in-jokes. Jaysbro (talk) 17:57, 30 April 2015 (UTC)[reply]

@Jaysbro: Done. Next time, just do it - think "EAFP - Easier To Ask For Forgiveness Than To Ask For Permission". By the way, the statement was actually wrong. Regards, Hayazin (talk) 17:48, 19 August 2018 (UTC)[reply]

Conversions method: names

[edit]

What does the attribution "due to D. Librik (Szudzik)" mean? Are Librik and Szudzik two people? Is Szudzik the maiden name of Librik? Does Librik work for the university of Szudzik? — Preceding unsigned comment added by 212.88.248.145 (talk) 03:02, 18 October 2016 (UTC)[reply]

Addition and Subtraction

[edit]

I see from reading this talk page that some people are having trouble understanding a carry or a borrow of 11 affecting two subsequent columns, and indeed I couldn't get my head round it either.

I wrote a paper on numbers to the base -2 back in the 80s and I tried to make it simple so that people could more easily understand how addition and subtraction work. The thing that makes it easier to comprehend is to realise that a carry of 11 to subsequent columns is actually a carry of -1, and a carry of -1 is a borrow of 1. Similarly, in subtraction, a borrow of 11 is a borrow of -1, which is a carry of 1.

Using this idea, the rules for addition and subtraction only affect one subsequent column and not two.

Here is an extract from the addition section of what I wrote all those years ago:

The first three addition rules are the same as for base +2:

Rule 1: 0+0 = 0

Rule 2: 0+1 = 1

Rule 3: 1+0 = 1

In base +2, the fourth rule is 1+1 = 0 carry 1. In base -2 this rule is slightly different: 1+1 = 0 carry 11

If you try adding 1 and 1 using this rule you get 110 which is 2 which is correct.

Clearly, a carry of 11 makes computation of subsequent columns more and more difficult.

But 11 is the base -2 representation of -1. So a carry of 11 is equivalent to a carry of -1 or a borrow of 1. So, we can change the fourth rule to:

Rule 4: 1+1 = 0 borrow 1

This makes the arithmetic easier as only the next column is affected, but now what happens when you get a borrow from a column containing two zeros, ie 0+0-1? This is now a base -2 subtraction. 0-1 in base -2 is 1 borrow 11 which is the same as 1 carry 1. So we need to use one of the rules of base -2 subtraction as a rule for base -2 addition:

Rule 5: 0-1 = 1 carry 1

Adding 1 and 1 now works again:

1+1 = 0 borrow 1

0+0-1 = 1 carry 1

0+0+1 = 1

Answer: 110

Finally, we now need a rule which allows for a carry to a column containing two 1s:

Rule 6: 1+1+1 = 1 borrow 1


To see this in action, add 4 and 2:

100

+110

First column: 0+0 = 0

Second column: 0+1 = 1

Third column: 1+1 = 0 borrow 1

Fourth column: 0+0-1 = 1 carry 1

Fifth column: 0+0+1 = 1

Answer: 11010 = 6


Now add 5 to 5:

101

+101

First column: 1+1 = 0 borrow 1

Second column: 0+0-1 = 1 carry 1

Third column: 1+1+1 = 1 borrow 1

Fourth column: 0+0-1 = 1 carry 1

Fifth column: 0+0+1 = 1

Answer: 11110 = 10 (decimal)

I hope this makes it simpler to understand


The logic circuit for a full adder would be:

The sum is the exclusive OR of all four inputs A EOR B EOR cp EOR bp

The carry is bp AND NOT A AND NOT B

The borrow is (A OR B) AND cp OR A AND B AND NOT bp

Jon Mountfort — Preceding unsigned comment added by Mrrash (talkcontribs) 14:04, 27 June 2018 (UTC)[reply]

Example implementation code

[edit]

There's an excessive number of example algorithm implementations in the Calculation section. That's appropriate on e.g. Rosetta Code, but not here. I think all of them should be removed except for one, and that one should be should be plain English or pseudocode (or at least a language that's particularly easy to understand even for non-programmers).

73.158.207.251 (talk) 13:32, 9 January 2022 (UTC)[reply]

Useless

[edit]

This article is completely impenetrable to someone who doesn't already know what negative bases are. A better introduction is needed as well as a properly explained basic example. 90.196.143.220 (talk) 17:18, 26 November 2022 (UTC)[reply]

Negative base fractions

[edit]

Note that in base -b, it is the rationals of the form that have two representations: x can be represented as or .

To convert to base -b, define x0 = x. For each , choose di ∈ {0, 1, ..., b-1} such that , then set . The base-(-b) expansion of x is then d0.d1d2...

Note that for other than the fractions with two representations, the reptend length in base -b of k/n (with k and n being coprime) is ordm(-b), where m is n with factors of b removed. This would give ordb+1(-b) = 1 for the the fractions with two representations as, but the actual value is 2.

The table is the negadecimal expansions for fractions with denominator ≤ 13.

Fractions Negadecimal expansions
1/2 1.5
1/3, 2/3 1.74, 1.47
1/4, 3/4 1.85, 1.35
1/5, 2/5, 3/5, 4/5 1.8, 1.6, 1.4, 1.2
1/6, 5/6 1.974, 1.247
1/7, 2/7, 3/7, 4/7, 5/7, 6/7 1.958, 1.895, 1.632, 1.589, 1.326, 1.263
1/8, 3/8, 5/8, 7/8 1.935, 1.785, 1.435, 1.285
1/9, 2/9, 4/9, 5/9, 7/9, 8/9 1.92, 1.83, 1.65, 1.56, 1.38, 1.29
1/11, 2/11, ..., 10/11 0.09 = 1.90, 1.9, 1.8, ..., 1.1
1/12, 5/12, 7/12, 11/12 0.0974, 1.6247, 1.5974, 1.1247
1/11, 2/13, ..., 12/13 0.083, 1.967, 1.830, 1.713, 1.796, 1.679, 1.542, 1.425, 1.308, 1.371, 1.254, 1.137

For the irrational numbers, π in base -10 is 4.95961346761020737967..., and e in base -10 is 3.32232223255905537676... 129.104.241.193 (talk) 04:31, 19 May 2024 (UTC)[reply]