Jump to content

How computers do mathematics


RWL

Recommended Posts

Ever wonder how the computer is able to preform arithmetic operations? I have a simple video explaining the basics of how mathematics is possible in a computer. Warning, this is meant to show basics.

Link deleted

Link to comment
Share on other sites

!

Moderator Note

Rule 2.7

Advertising and spam is prohibited. We don't mind if you put a link to your noncommercial site (e.g. a blog) in your signature and/or profile, but don't go around making threads to advertise it. Links, pictures and videos in posts should be relevant to the discussion, and members should be able to participate in the discussion without clicking any links or watching any videos. Videos and pictures should be accompanied by enough text to set the tone for the discussion, and should not be posted alone. Users advertising commercial sites will be banned.

Link to comment
Share on other sites

Only if the binary string is an address.

 

 

I mean the full adder is only a method of incrementing a binary string by a fixed amount what that binary corresponds to doesn't have to be numbers at all it could be letters or practically anything really.

Link to comment
Share on other sites

A long time ago, I played on an IBM 1620 computer, which had a number of odd features, one of which was it loaded the addition and multiplications tables from disk and did decimal arithmetic with a variable number of digits using these two tables. Computers typically operate on binary values using hardware to add, subtract, multiply and divide. Although, an iterative division algorithm such as Newton–Raphson division is commonly used; it can be built entirely with hardware, but is often microcode.

 

AFAIK most people don't care about how computers do arithmetic, except hardware designers and a few geeks like me.

Link to comment
Share on other sites

Only if the binary string is an address.

I think he meant index to array

 

float values[ 1024 ];

(...)

float value = values[ index ];

 

CPU is doing it by adding address of 'values' variable together with 'index' variable (multiplied by fixed size of entry f.e. sizeof( float ), simple bit-shift).

And then reading memory from this final address.

 

Multiplication a * b will be possible to replace by looking at a_table[ b ] (for integers either a & b).

 

So for a-b in range 0...255 (8 bits),

there is needed array with unsigned short (16 bits),

with size 256*256=65536 entries.

(but it could be reduced to 32768 or slightly less, because a*b=b*a and 1*a=a and 0*a=0)

 

A long time ago, I played on an IBM 1620 computer, which had a number of odd features, one of which was it loaded the addition and multiplications tables from disk and did decimal arithmetic with a variable number of digits using these two tables.

My 2nd programmer had to do it just few years ago.

Plentiful PIC/IC do have just basic operations.

And everything else has to be emulated with code, or read from lookup table (stored on EPROM/EEPROM/flash).

Edited by Sensei
Link to comment
Share on other sites

My 2nd programmer had to do it just few years ago.

Plentiful PIC/IC do have just basic operations.

And everything else has to be emulated with code, or read from lookup table (stored on EPROM/EEPROM/flash).

The PIC microprocessors were 8-16 bit machines; the 1620 was a 4-bit machine made before integrated circuits with germanium transistors about the size of a pencil eraser. Each 6 bit memory word had a parity bit, a flag bit, and 4 bits that contained a decimal digit (0-9) or other stuff. A sequence of 5 digits was a memory address. The RISC PIC was complex compared to the 1620 CPU, but comparison is kind of like apples and oranges.

Edited by EdEarl
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.