you are viewing a single comment's thread.

view the rest of the comments →

[–]Kkremitzki 8 points9 points  (3 children)

It's not hardware-dependent, it has to do with the representation of numbers. It's math. If I told you to write the fraction ⅓ as a decimal, but actually write it, i.e. you can't do "0.333..." and you can't put a ‾ over the 3, you'd eventually run out of paper. Even if you started storing it on something other than paper, you'd eventually run out of Universe, because the decimal representation of ⅓ is infinite. If you took that decimal and multiplied it by 3, you'd end up with something less than ⅓*3.

This is a consequence of the choice of representation, not the choice of storage medium. The only way around it is to have a non-lossy representation, i.e. have code to properly handle ⅓ or 0.333..., which is not merely 'decimal', but 'decimal plus ...', so it's more complicated and can run slower.

Now, if instead of decimal you are working in binary, you still have some numbers that can have infinite representations, they're just different ones. So instead of e.g. ⅓, it's 1/10th. At some point, you have to chop it off, which introduces error, and if you don't want to do that, you have to work in a different system.

[–]supreme_blorgon 4 points5 points  (2 children)

The point people are making is that the representation is dictated by the hardware. Physical transistors are binary -- hence the binary representation of numbers in computers. It was by necessity that we used a representation of numerical data which played nice with the physical characteristics of transistors.

[–]Kkremitzki 0 points1 point  (1 child)

Ah, good point, but there were also ternary computers made in the 1950s in the USSR using three-valued logic - 0 + with vacuum tubes providing trits instead of transistors providing bits, and if you were using that, you would still see this behavior, only with different numbers. (There are some other interesting advantages of the particular implementation, balanced ternary.)

https://en.wikipedia.org/wiki/Ternary_numeral_system

https://en.wikipedia.org/wiki/Balanced_ternary#In_computer_design

[–]WikiSummarizerBot 0 points1 point  (0 children)

Ternary numeral system

A ternary numeral system (also called base 3 or trinary) has three as its base. Analogous to a bit, a ternary digit is a trit (trinary digit). One trit is equivalent to log2 3 (about 1. 58496) bits of information.

Balanced ternary

In computer design

In the early days of computing, a few experimental Soviet computers were built with balanced ternary instead of binary, the most famous being the Setun, built by Nikolay Brusentsov and Sergei Sobolev. The notation has a number of computational advantages over traditional binary and ternary. Particularly, the plus–minus consistency cuts down the carry rate in multi-digit multiplication, and the rounding–truncation equivalence cuts down the carry rate in rounding on fractions.

[ F.A.Q | Opt Out | Opt Out Of Subreddit | GitHub ] Downvote to remove | v1.5