1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Colt1911 [192]
3 years ago
10

Write down the bit pattern in the fraction of value 1/3 assuming a floating point format that uses Binary Coded Decimal (base 10

) numbers in the fraction instead of base 2. Assume there are 24 bits, and you do not need to normalize. Is this representation exact?
Computers and Technology
1 answer:
vekshin13 years ago
8 0

Answer:

The resulting floating bit representation is:

0 00101010101010101 000001                 (24 bits)

Explanation:

Converting 1/3 in decimal: 0.3333...

For converting decimal number into binary we know that the digits on the left of decimal are multiplied with positive powers of 2 (starting from zero) while digit on right side are multiplied with negative powers of  2 (starting from -1).

For example: The number 123.45 (decimal) is equal to:  

=1 * 10^2 + 2 * 10^1 + 3 * 10^0 + 4 * 10^-1 + 5 * 10^-2

=1 * 100 + 2 * 10 + 3 * 1 + 4 * 0.1 + 5 * 0.01

Now for the decimal number 0.3333... the pattern becomes:

0*0 . 3*2^-1+3^-2+3^-3+3^-4.....

The first negative power (2^-1 = 0.5) is too large to fit. The next one is 2^-2 = 0.25 and it fits, so let's subtract that: 0.3333… - 0.25 = 0.08333… The next power that fits is 2^-4 = 0.0625. Subtracting that from the remaining result we get 0.08333…- 0.0625 = 0.0208333…

Continuing on this line we get:

0.3333333…. (decimal) = 0.0101010101010101….. (binary)

Now for creating a 24 bit floating point format that uses Binary Coded Decimal we have to assign bits as follows:

  • 6 bits for the exponent
  • 17 bits for the mantissa.
  • In this case the sign bit is 0 (1 bit) because the number is non-negative.

As we need not to normalize obtained number, then the exponent will be simply 1, and the mantissa remains: 00101010101010101...

Now

The mantissa is 0.0101010101010101 (17 bits)

The exponent is 000001 (6 bits).

The resulting floating bit representation is 0 00101010101010101 000001

You might be interested in
Guys for those who are familiar to bubble gum sim...THERE IS A HUGE EVENT AND I DONT WANT TO FAIL AN EVENT...(again) is anyone w
Alborosie
Dude is u still use this app then friend meh on roblox
6 0
2 years ago
Is the address 7b invalid regarding cell references?
Lubov Fominskaja [6]

Answer:

It is not valid

Explanation:

I'll assume the question relates to cell referencing in Microsoft Excel.

To reference a cell in Excel, we make use of the following steps:

  • Write out the cell column name first
  • Followed by the row number

7b implies that, the row number first, followed by the column name; this doesn't follow the naming convention of cells.

Hence, 7b is invalid.

3 0
3 years ago
This script should:
denis23 [38]

Answer:

the answer is d

Explanation:

5 0
3 years ago
29
denis23 [38]

The correct answer is A it transfers control to the next loop in the program.


The most valid answer is that the break statement Exits the loop and continues executing the program, but assuming that there are other loops, the control of the program will go to them since the first loop is broken out of.


3 0
3 years ago
1. Scrieţi un program care citeşte un număr natural n şi determină produsul cifrelor impare ale lui n. De exemplu, pentru n = 23
saveliy_v [14]

Answer:

1.  

num1 = input("Enter the value of n")  

n = int(num1)  

def calc(n):  

Lst = []  

while n > 0:  

remainder = n % 10  

Lst.append(remainder)  

quotient = int(n / 10)  

n = quotient  

i = len(Lst) - 1  

sum = 1  

for i in range(0, len(Lst)):  

if(i % 2 != 0):  

sum *=Lst[i];  

else:  

continue  

print(sum)  

return(0)  

\ r2

num=input("Enter the value of n")

arr=[12,-12,13,15,-34,-35,35,42]

def div7positive():

  sum = 0

  m = 0

  i = 0

  while m <= 7:

      if(arr[i]>=0 and arr[i]%7 == 0):

          sum +=arr[i]

      i = i + 1

      m += 1

       

   

  print("sum of number divisible by 7 and positive is", +sum);

div7positive()

\ r

\ r3.Write an algorithm that reads a natural number n and calculates the sum:

\ rS = 1 / (1 * 2) + 1 / (2 * 3) + 1 / (3 * 4) +… + 1 / ((n-1) * n)

\ r

num=input("Enter the value of n")

def sumseries():

  sum = 0

  m= 0

  while m <= 7:

      sum +=1/((int(num)-1)*int(num))

      m += 1

  print("sum of series is", +sum)

sumseries()

\ R4. Read a natural number n. Calculate the sum of its own divisors n. For example, for n = 12, the sum of its own divisors is 2 + 3 + 4 + 6 = 15

num=input("Enter the value of n")

def sumdivisors():

  sum = 0

  m= 2

  while m <= int(num):

      if int(num) % m == 0:

          sum += m

      m += 1

  print("sum of divisors is", +sum)

sumdivisors()\ r

\ R5. We read a natural number n and then whole numbers. Calculate and display the sum of the natural numbers between 10 and 100. For example, if n = 5 and then read 30, –2, 14, 200, 122, then the sum will be 44 (that is, 30 + 14).

\ r

Lst = []  

num=input("Enter the value of n")

i = 0

while i<= int(num):

  num1=input("Enter the element of array")

  Lst.append(int(num1));

  i += 1

def numbet0and100():

  sum = 0

  m= 0

  while m <= int(num):

      if Lst[m] <= 100 or Lst[m] >=0:

          sum += Lst[m]

      m += 1

  print("sum of numbers between 0 and 100 is", +sum)

numbet0and100()

\ R6. A natural number n of maximum 4 digits is read. How many digits are in all numbers from 1 to n? For example, for n = 14 there are 19 digits, and for n = 9 there are 9 digits.

\ r

num = input("Enter the value of n")

n = int(num)

print(“sum as required is:” (n -9) + n)  

 

\ R7. Read the natural numbers n and S, where n can be 2, 3, 4 or 5. Show all the numbers of n digits that have the numbers in strictly ascending order, and the sum of the digits is S. For example, for n = 2 and S = 10, 19, 28, 37, 46 will be displayed.

num = input("Enter the value of n")

n = int(num)

Lst = []

def calc(n):

  i = 1

  total = pow(10,n)

  while i <= total:

      j = i

      while j > 0:

          remainder = j % 10  

          Lst.append(remainder)

          quotient = int(j / 10)

          if quotient > 0:

              j = quotient

          else:

              length = len(Lst) - 1

              sum = 0

              while length >= 0:

                  sum += Lst[length]

                  length = length - 1

              if sum == pow(10,n):

                  print(j)

              k = len(Lst)

              del Lst[0:k]

      i = i + 1

  return(0)

calc(n)

\ r

\ R8. We consider the row 1, 1, 2, 3, 5, 8, 13, ... in which the first two terms are 1, and any other term is obtained from the sum of the preceding two. Write an algorithm that reads a natural number n and displays the first n terms of this string. For example, for n = 6, 1, 1, 2, 3, 5, 8 will be displayed.

\ r

nterm = int(input("What number of terms do you want?"))

a, b = 0, 1

totalcount = 0

if nterm <= 0:

 print("Please input a positive number")

elif nterm == 1:

 print("Fibonacci number upto which",nterm,":")

 print(a)

else:

 print("Fibonacci series:")

 print(nterm)

 while totalcount < nterm:

     print(a)

     nth = a + b

     a = b

     b = nth

     totalcount += 1

 

\ 9. Write an algorithm that reads two natural numbers n1 and n2 and displays the message "yes" if the sum of the squares of the digits of n1 is equal to the sum of the numbers of n2 or "no" otherwise. For example, for n1 = 232 and n2 = 881, "yes" will be displayed, and for n1 = 45 and n2 = 12, "no" will be displayed.

num1 = input("Enter the value of n")

num3 = input("Enter the value of n")

n = int(num1)

num2 = int(num3)

def calc(n):

  Lst = []

  while n > 0:

      remainder = n % 10  

      Lst.append(remainder)

      quotient = int(n / 10)

      n = quotient

       

  i = len(Lst) - 1

  sum = 0

  while i >= 0:

      sum += Lst[i]* Lst[i]

      i = i - 1

  return(sum)

def calc1(num2):

  Lst = []

  while num2 > 0:

      remainder = num2 % 10  

      Lst.append(remainder)

      quotient = int(num2 / 10)

      num2 = quotient

       

  i = len(Lst) - 1

  sum = 0

  while i >= 0:

      sum = Lst[i] + Lst[i]

      i = i - 1

  return(sum)

a = calc(n)

b = calc1(num2)

if a == b:

  print("yes")

else:

  print("No")

\ r

\ R10. Write an algorithm that reads a natural number n and displays the message "yes" if all of its n numbers are distinct, or "no" if n does not have all the distinct digits. For example, for n = 37645 it will display "yes" and for 23414 it will show "no".

\ r

num1 = input("Enter the value of n")

n = int(num1)

def calc(n):

  Lst = []

  while n > 0:

      remainder = n % 10  

      Lst.append(remainder)

      print( remainder)

      quotient = int(n / 10)

      n = quotient

       

  flag = 1

  for i in range(0, len(Lst)):

      for j in range(i+1, len(Lst)):    

          if Lst[i] == Lst[j]:    

              flag = 0

              break

           

  if flag == 1:

      print("YES")

  else:

      print("NO")

  return(0)

Explanation:

Please check answer.  

3 0
2 years ago
Other questions:
  • PLS HELP!! 50 Points! Will mark correct answer brainliest!!
    11·2 answers
  • What properties make it suitable to be used for musical instruments?
    8·1 answer
  • ____ is a utility that can verify that TCP/IP is installed, bound to the NIC, configured correctly, and communicating with the n
    11·1 answer
  • Find products that satisfy BOTH conditions below:______
    6·1 answer
  • ____________________________ and _________________________ are 2 negative impacts of the internet on businesses.
    8·1 answer
  • PLEASE HELP ITS TIMED Ishmael would like to capture a selected portion of his screen and then capture actions he performs on tha
    8·1 answer
  • Explain drawing and painting package.​
    12·1 answer
  • A _ is the acknowledgment of a potential noncomformity, or an opinion regarding an issue that is not covered by a standard
    6·1 answer
  • IP ______ occurs when an intruder computer fools a network into believing its IP address is associated with a trusted source.
    13·1 answer
  • What is the difference between concrete language and abstract language? give an example of each.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!