Question: Using the function decimal2binary, can a computer tell the numbers 1.23456 and 1.2345 apart if bfloat16 numbers are used? function [m,p,r] = decimal2binary(x,N) %Input %x:

Using the function decimal2binary, can a computer tell the numbers 1.23456 and 1.2345 apart if bfloat16 numbers are used?

function [m,p,r] = decimal2binary(x,N)

%Input %x: decimal number to translate %N: number of mantissa bits to use. %output %m: vector of N mantissa bits %p: decimal exponent of the binary floating number %r: remainder

m = zeros(N,1); p = floor(log(x)/log(2)); n = p; x = x-2^n;

for i = 1:N n = p-i; if 2^n <= x m(i) = 1; x = x-2^n; end end

r = x;

end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!