Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to code this on matlab? | 5 Floating Point Precision vs Fixed Precision function (double stats, int64.stats] = comparePrecision (binary) Type Description Input binary

How to code this on matlab?
image text in transcribed
| 5 Floating Point Precision vs Fixed Precision function (double stats, int64.stats] = comparePrecision (binary) Type Description Input binary 1x64 logical Logical array of length 64 made of only zeros (false) and ones (true), representing a single precision floating point number. Output Type double.stats 1x3 double Description The value, precision, and maximum representable num- ber in double format, listed in that order. The value, precision, and maximum representable num- ber in int64 format, listed in that order. int64.stats 1x3 int64 Each numerical data type in Matlab has a finite amount of different numbers it can represent, associated with the number of bits it uses in your computer's memory. Thus, rather than there being a continuous number line that we would expect in mathematical theory, for numbers stored in a computer, the number line is a set of discrete values that can be represented with gaps in between them where no numbers can be stored. The distance(absolute difference) between these representable numbers is often referred to as machine precision and represents the accuracy with which we can store numbers and perform mathematical operations on a computer. For this problem, we will explore how the machine precision varies for two different data formats: double and int64, both of which take up 64 bits and thus can represent the same quantity of distinct numerical values). In this problem, you are given the binary representation of a double precision number. You should take this data and do the following once for the double data format and once for the int64 data format. 1. Calculate the numerical value, getting the value of the double from the binary data and getting the value of the int64 from the double data. 2. Find the machine precision to which this number is represented in int64 or double data format. 3. Find the largest positive (non-infinite) numerical value that can be represented in int 64 or double data format. Tips Again, note that the output type should be double and int64. Restriction: You should not use the Matlab built-in functions eps or realmax for this problem. | 5 Floating Point Precision vs Fixed Precision function (double stats, int64.stats] = comparePrecision (binary) Type Description Input binary 1x64 logical Logical array of length 64 made of only zeros (false) and ones (true), representing a single precision floating point number. Output Type double.stats 1x3 double Description The value, precision, and maximum representable num- ber in double format, listed in that order. The value, precision, and maximum representable num- ber in int64 format, listed in that order. int64.stats 1x3 int64 Each numerical data type in Matlab has a finite amount of different numbers it can represent, associated with the number of bits it uses in your computer's memory. Thus, rather than there being a continuous number line that we would expect in mathematical theory, for numbers stored in a computer, the number line is a set of discrete values that can be represented with gaps in between them where no numbers can be stored. The distance(absolute difference) between these representable numbers is often referred to as machine precision and represents the accuracy with which we can store numbers and perform mathematical operations on a computer. For this problem, we will explore how the machine precision varies for two different data formats: double and int64, both of which take up 64 bits and thus can represent the same quantity of distinct numerical values). In this problem, you are given the binary representation of a double precision number. You should take this data and do the following once for the double data format and once for the int64 data format. 1. Calculate the numerical value, getting the value of the double from the binary data and getting the value of the int64 from the double data. 2. Find the machine precision to which this number is represented in int64 or double data format. 3. Find the largest positive (non-infinite) numerical value that can be represented in int 64 or double data format. Tips Again, note that the output type should be double and int64. Restriction: You should not use the Matlab built-in functions eps or realmax for this

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

d. Who are important leaders and heroes of the group?

Answered: 1 week ago