PC [Work in Progress] Floating Point Calculator with Order of Operations

Programmatic

Steampunker
I've begun working on a floating point calculator that supports parentheses and the order of operations. However, since this will take a very long time to make, I've decided to reveal my work so far.
First of all, I should probably explain what floating point is. Floating point is a special form of binary in which is able to support a decimal point, rather than only processing integers. Floating point works by breaking a 16, 32, or 64 bit number into three parts: 1 bit to represent the sign of the number (0 for positive, 1 for negative), a few bits to represent an exponent, and the remaining bits to represent the value that is multiplied by the exponent (this is called the mantissa or significand).
Floating point is basically a binary form of scientific notation. Rather than having a decimal number multiplied by a power of ten (1.234 * 10^3, for example), floating point is represented as a binary number multiplied by a power of two, also represented in binary (1.100101011, * 2^10110 for example). Floating point can represent numbers that are less than one, or, if a very large exponent value is given, numbers far larger than those that can be represented by integers.
Overall, floating point numbers are more flexible than integers, but operations in floating pointer are also more complex and slower.
Now, I will show the two components of the calculator that I've completed.

Adder/Subtractor:

fcs6qb.png


fvabt3.png


Oddly enough, of the four basic operations, addition and subtraction in floating point are by far the most complex. This is due to a fact that is present in both floating point and scientific notation: you can not add two numbers if their exponents are different. If you try two add two decimal numbers such as 1.234 * 10^3 and 4.321 * 10^5, you must first adjust one of the two numbers so that the exponents are the same. The same adjustment must be made in order to add floating point numbers, which leads to a lot of bit shifting, comparisons, and accumulation. After this is all settled, the mantissas can simply be added as if they were integers. An additional bit shift may have to be performed on the resulting value in order to prevent any bits from "falling off" the mantissa during the addition. Finally, additional measures are taken in order for the adder/subtractor to be compatible with negative numbers, such as inverting the accumulator and determining the sign of the final result.

Memory Stack:

2mo6pty.png


x0u1b9.png


Don't be overwhelmed by its size; it's basically just one memory cell copied and pasted into a 19 x 16 grid. The memory stack is a device that temporarily stores data so that it can later be pulled out of the stack and used in another operation. Each of the 16 rows in the stack contains 16 bits of memory to store a floating point number, and an extra 3 bits to store an operation (001 for addition, 010 for subtraction, 011 for multiplication, and 100 for division). Triggering the second red wire from the left will cause the data carried in the following row of red wires to be written to the stack. Data can then be read from the series of vertical blue wires. Triggering the first red wire from the left will remove an item from the stack. The memory stack will enable that calculator to use use parentheses and the order of operations.

That's all for now. I will post another update once I'm finished making the multiplier and divider. Also, I will eventually have to make a decimal to floating point converter, which will be far more difficult to make than any other part of the calculator, so I would appreciate any advice that you may have on how to make one.
 
Last edited:
My god... This is the most insane mathematical thing I have seen built out of the logic gates so far! The RAM is extremely compact as well, props to you!~ I am thoroughly impressed with your work! And you're making it floating point too, which is absolutely nuts... I wish I knew how it worked more in detail, but I get the essence of it. I'm at the stage of half-understanding it but it isn't a perfect knowledge. You seem to be very educated about the subject and computers in general. I've only scraped the surface, I suppose. Seeing this stuff is simply mind blowing.
 
So, when we will see the very first iPhone release? New electronics engineers are growing in there! Congratz friend, very good design.

Though I can't see how it works :/
 
Impressive build, but a little correction on the wording here:

If you write everything in binary, you also need to turn the 2 into a 10 :p So even in binary, it's still m * 10^e, the 10 just has a different value.

True. I just thought it would be clearer to readers if I left the 2 as 2, since I thought some readers would interpret a 10 as decimal 10, rather than binary 2.
 
Back
Top Bottom