Interestingly some numbers can be perfectly represented in Base 10, but not in Base 2. An example is one-tenth (in Base 10, this is 0.1; in Base 2 this is a repeating decimal. Suppose we set both f and g to one-tenth using the statements below. f = 0.1; g = 0.1; Answer the following questions. For each, mark the best answer. Which will be closer to the actual value of one-tenth? f g Which can hold higher values? f g Which takes more memory? f g When using real values I should always use type double, to be safe. True False

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter3: Data Representation
Section: Chapter Questions
Problem 7VE
icon
Related questions
icon
Concept explainers
Question

Interestingly some numbers can be perfectly represented in Base 10, but not in Base 2. An example is one-tenth (in Base 10, this is 0.1; in Base 2 this is a repeating decimal. Suppose we set both f and g to one-tenth using the statements below. f = 0.1; g = 0.1; Answer the following questions. For each, mark the best answer. Which will be closer to the actual value of one-tenth? f g Which can hold higher values? f g Which takes more memory? f g When using real values I should always use type double, to be safe. True False

Java and C have two ways to declare real values:
float (32 bits) and double (64 bits).
Each of these use the IEEE Floating Point Standard, with the following number of
bits for the sign, exponent and mantissa:
Standard
32-bit (float)
64-bit (double)
Sign
1
1
Exponent
8
11
Mantissa
23
52
Transcribed Image Text:Java and C have two ways to declare real values: float (32 bits) and double (64 bits). Each of these use the IEEE Floating Point Standard, with the following number of bits for the sign, exponent and mantissa: Standard 32-bit (float) 64-bit (double) Sign 1 1 Exponent 8 11 Mantissa 23 52
Expert Solution
steps

Step by step

Solved in 6 steps

Blurred answer
Knowledge Booster
Operators
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning