C Programming - Floating Point Issues - Discussion

Discussion :: Floating Point Issues - General Questions (Q.No.2)

2. 

What will you do to treat the constant 3.14 as a long double?

[A]. use 3.14LD
[B]. use 3.14L
[C]. use 3.14DL
[D]. use 3.14LF

Answer: Option B

Explanation:

Given 3.14 is a double constant.

To specify 3.14 as long double, we have to add L to the 3.14. (i.e 3.14L)


Riya said: (Sep 16, 2010)  
Can anyone explain this in detail that how it works if anyone understand?

Ashish said: (Dec 3, 2010)  
For the long double Lf is used as suffix then how L is used?

Aparna said: (Mar 2, 2011)  
@Ashish

No its totaly wrong.

For long double 'L' is used as suffix.

Mohanraj said: (May 21, 2011)  
Please explain how 3.14 is treat as double?

Chaitanya said: (Aug 4, 2011)  
long double: %LF or %Lf
double :%lf
float:%f or %e or %g
int :%i or %d
long int:%ld or %li
unsigned long:%lu
unsigned int:%u

Subhalaxmi said: (Sep 12, 2011)  
What is the use of LD & DL?

Pavan said: (Nov 3, 2011)  
What exactly difference between double & long double & int?

Harshareddy said: (Jan 3, 2012)  
The double is used for floating 44.45, int for integers like 2,567etc , long double for large floating values like 6.98765342 .

Rajesh said: (Jan 27, 2012)  
For the long double LF is used in c.

Sri Ram said: (Sep 1, 2012)  
Double is also like floating point but having size of 4 bytes,double has 8 bytes,long double has 10 bytes and integer has 2 bytes.So long double can store larger floating points also.Here 3.14 is a long double.

Rathi said: (Aug 12, 2013)  
A floating-point constant without an f, F, l, or L suffix has type double. If the letter f or F is the suffix, the constant has type float. If suffixed by the letter l or L, it has type long double.

Mahendra Kumar Verma said: (Mar 2, 2014)  
@Chaitanya.

In which book defined all type according to your explanation!

Madhavi said: (Apr 26, 2015)  
3.14 can be just double now why is it long double? Can anyone please explain.

Gyan said: (Aug 30, 2015)  
Please briefly explain.

Rathisha said: (Feb 25, 2018)  
What is difference between float and double?

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.