Ask Your Question
2

How is it possible for the maximum value of double to be greater than the maximum value of long, despite both types having an equal memory size of 8 bytes in language C?

asked 2021-04-26 11:00:00 +0000

devzero gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-04-04 06:00:00 +0000

lakamha gravatar image

The maximum value of double is greater than the maximum value of long because they represent different types of data. Long is an integer type that can store whole numbers with a precision of up to 64 bits or 8 bytes. Double is a floating-point type that can store decimal numbers with a precision of up to 64 bits or 8 bytes as well. However, double uses some of its bits to store the exponent, which allows it to represent larger values than long. Therefore, even though they have the same memory size, double can represent larger values due to its ability to represent fractional values and a wider range of numbers.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-04-26 11:00:00 +0000

Seen: 19 times

Last updated: Apr 04 '23