snippetjournal

– notes, snippet codes, and my journal

Difference Between Equality and Equivalence

with 2 comments

what is the difference between Equality and Equivalence :
a variable can be equal when a value of variable are the same. example of equal variable but doesn’t equivalent  :

int a = 3;
double b = 3.0;

variable a is equal to variable b, but the both variable are not equivalent, because each variable represent the different type.

variable a represent integer type, and variable b represent the double type.

example of equal variable and equivalent variable:

int a = 3;int b = 3;

variable a and variable b are equal and equivalent, because both variable has the same value and data type, integer type

equality or equal is about symbol = , equivalent is about symbol >, <
example :

a = 3;
b = 3;

a = b (a is equal or equality with b)

Written by snippetjournal

September 29, 2012 at 1:57 pm

Posted in Programming

Tagged with ,

2 Responses

Subscribe to comments with RSS.

  1. Isn’t it the other way around? The first part where you are comparing int a and double b. They are equivalent but not equal.

    Avinash

    November 13, 2014 at 5:45 am

    • in programming a variable is equivalent when represent the same data type, and can be called equal when have the same value🙂

      snippetjournal

      November 13, 2014 at 1:13 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: