What is the “~” symbol used for? - letsdiskuss
Official Letsdiskuss Logo
Official Letsdiskuss Logo

Language



Blog
Earn With Us

A

Anonymous

Marketing Manager (Nestle) | Posted on | Education


What is the “~” symbol used for?


0
0




digital marketer | Posted on


In Computer Programming language, tilde(~) is called bitwise supplement operator.


Permit say, x is an Integer.

So, the cost of ~x can be -x-1.

Example :
1.) if x = 10 then
~x = -eleven;

2.) if x = 0 then
~x = -1;

3.) if x = -10 then
~x = 9;

Explanation :
while x = 10, then its binary representation could be 0000 1010 and now if we compute the cost of ~x(by way of inverting all of the bits) , we will get binary representation 1111 0101 which is now equal to -eleven

This has happened because inverting all of the bits will always trade the sign of an integer.

That’s why we usually gets the value of ~x through complementing all of the bits and subtracting 1 from it.

Why Subtracting 1 ?? As we all understand terrible of a variety of is received via complementing that quantity and adding 1 to that quantity.


In Maths,I knew the symbol “~” is known as as tilde & used for approximation in Mathematics.

Letsdiskuss

In Spanish, it is used handiest on pinnacle of an N to provide a new letter, Ñ, which has a new sound.


In Portuguese, it modifications the way A and O are pronounced, àand Õ, nevertheless the ones sounds however with a more nasal sound.

Hope this may assist you.


0
0