Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

are these calculator answers wrong for binary subtractions?

Status
Not open for further replies.

PG1995

Active Member
Hi

Why is my calculator giving these 'wrong' values when I perform binary subtractions on it? Kindly help me with it. Thank you.

Regards
PG
 
Why do you think they are wrong?
They look fine to me.

First one, 1 - 3 = -2

Second one 7 - 3 = 4

JimB
 
Thank you, JimB.

I'm only interested in "1 - 3 = -2" case; I intended to include the other picture only as a reference. I think I get it now. Isn't the calculator using 2's complement to represent the value of "-2" using 10-bit word? Thanks for the help.

Regards
PG
 
Yes 10 bit word and the answer is in 2s complement.

JimB
 
Hi,


Here is what it looks like in 64 bit hex and 128 bit hex...

Code:
 0000000000000001
 0000000000000003
------------------
 FFFFFFFFFFFFFFFE



 00000000000000000000000000000001
 00000000000000000000000000000003
----------------------------------
 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE
 
Neg logic operator

Hi

Could you please tell me what this "Neg" does? I assume it stands for 'negation'. How come Neg 1 = 1111111111? Thank you.

Regards
PG
 
I have a similar Casio calculator, mine is a fx-115MS.

To tell the truth I hate the damned thing!

JimB
 
Hi

Could you please tell me what this "Neg" does? I assume it stands for 'negation'. How come Neg 1 = 1111111111? Thank you.

Regards
PG

Hi,

Negation is usually taken to be different than inversion (ie inverting the digital word). Inversion takes 1111 and produces 0000 but with negation it uses the twos complement negative value which is minus the value. So 1 would produce 1111 with a 4 bit word because 1111 means -1 in twos complement binary arithmetic. Actually 1 produces -1 but in binary that is 1111 not 0000.
Inverting 0001 produces 1110 but that is just simple inversion, not the same as negation.
 
I have a similar Casio calculator, mine is a fx-115MS.

To tell the truth I hate the damned thing!

JimB

Hi JimB

I don't know why you don't like it. Actually last month I lost my old Casio 991MS so I had to bought a new one because I like it. I also have TI-89 but the 89 is not good for simple calculations. For instance, it's a easier to do calculations in different bases on this Casio calculator than on the 89.

Hi,

Negation is usually taken to be different than inversion (ie inverting the digital word). Inversion takes 1111 and produces 0000 but with negation it uses the twos complement negative value which is minus the value. So 1 would produce 1111 with a 4 bit word because 1111 means -1 in twos complement binary arithmetic. Actually 1 produces -1 but in binary that is 1111 not 0000.
Inverting 0001 produces 1110 but that is just simple inversion, not the same as negation.

Hi MrAl

I think I understand you. Neg (5) = 2's complement of (5-1) = 1100. This is the value I get on the calculator but the calculator uses 10-bit word. Thank you for the help.

Regards
PG
 
The representation of the answer is purely down to the max number of significant bits that can be displayed or stored.
In 8 bits, -1 = 0xFF or 255 as a unsigned number
in 16 bits, -1 = 0xFFFF or 65535 "" "" ""

It's a dangerous area to get into unless you understand the CPU architecture which sadly most high level programmers don't understand what signed and unsigned numbers are.

Learning assembler is better than learning C as a beginner but that's another thread. You get to learn how the machine works at the coal face and then go on to learn good C programming skills regardless of the architecture.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top