C Programming - Declarations and Initializations - Discussion

Discussion Forum : Declarations and Initializations - General Questions (Q.No. 6)
6.
By default a real number is treated as a
float
double
long double
far double
Answer: Option
Explanation:

In computing, 'real number' often refers to non-complex floating-point numbers. It include both rational numbers, such as 42 and 3/4, and irrational numbers such as pi = 3.14159265...

When the accuracy of the floating point number is insufficient, we can use the double to define the number. The double is same as float but with longer precision and takes double space (8 bytes) than float.

To extend the precision further we can use long double which occupies 10 bytes of memory space.

Discussion:
50 comments Page 5 of 5.

Rahul said:   1 decade ago
1. I need clarification where we use double and where we use float.

2. How data types are occupy the memory? If we gave int i=3 then it occupy the memory as 1 1 0 right or wrong and if we gave 3.2 how it will take.

Chinna@RGUKT said:   1 decade ago
Friends I have one doubt, would you clarify?
in ANSI C,
The precedence order is !, ~, ++, --, +, -, *, (type) , sizeof.
But, in Let Us C,
The precedence order is -, ++, ~, !, &, *, (type) , sizeof.
What is the correct order?

Another doubt is.
In ANSI C, comma (,) operator associativity is left to right.
But in Let Us C, right to left.
What is the correct associativity?
Please tell me?

Klakston said:   1 decade ago
That question just only mentioned default real number so we using only float variable then why they used double. Just I need some more clarifications.

Klakston said:   1 decade ago
There are three types of constants:
1)Integer constants.
2)Real constants.
3)Char constants.

INTEGER CONSTANTS:
* It is have atleast one Digits.
* It must not have decimal point value.
* Normal unsigned value mentioned Positive

REAL CONSTANTS:
There are two types Real constants form:Fractional form, Exponential form.
Fractional Form:
* It is have at least one Digits.
* It must have decimal point value.
* Normal value mentioned Positive.
Exponential form: That constants should be used 'e' exponent.value declared before 'e' that is called "Mantissa".

CHAR CONSTANTS:
Char constants nothing but a single alphet,single digits,single symbols enclosed inverted commas. like 'A' or '1' or '='.
So Decimal value should be mentioned Real constants and then Float and Double are keywords of Real constants.

Gana said:   1 decade ago
What is double ?

Cnu said:   1 decade ago
Double is used to define BIG floating point numbers.

Satyaveer Kumar said:   1 decade ago
Since the double type have long precision than float type, it has the larger value than the float. Hence, the statement inside the "if (a==b)" is false and hence the else statement got printed.

Aditya gupta said:   1 decade ago
Why can't be a floating point number?

Rahul jain said:   1 decade ago
What is difference between float and double ?

Aafreen said:   1 decade ago
Real number means all the numbers in the number line.. So, we never ever know the number after the number 1. It may be 1.00000000000000000000...

So, we can't define it as float due to small precision.
It can be defined using double/long double.

So, the answer double is correct.


Post your comments here:

Your comments will be displayed after verification.