Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python Part I: Convert Decimal Format to Binary Fixed-point Format (20 points) Write a function decimalto.fixed.point that takes only one argument, a string called value

image text in transcribedpython
Part I: Convert Decimal Format to Binary Fixed-point Format (20 points) Write a function decimalto.fixed.point that takes only one argument, a string called value that contains a decimal number that could be positive or negative and which includes a fractional part. The function converts the decimal number into its fixed-point binary representation and returns the new representation. The function should generate exactly 23 digits to the right of the radix point. More on this below. CSE 101 Fall 2017 Lab #10 Page 1 Here is the general idea of how to perform the conversion. First, separate off the whole number portion of the value (i.e., those digits to the left of the decimal point) and convert that part into binary. (Hint: use split ( and bin Then, separate off the fractional part i.e, those digits to the right of the decimal point) and convert that part into binary using the multiplication algorithm covered on slide 44 of the Unit 10 lecture notes. You should perform exactly 23 multiplications by the number 2 in order to generate the needed 23 digits. You may assume that only a negative sign might appear at the start of a number, never a positive sign. You might find the following Python functions useful bin ( ) : https://docs.python.org/3/library/functions.html#bin int () : https://docs.python.org/3/library/functions.html#int float () : https://docs.python.org/3/library/functions.html#float . split ( ) : https://docs.python.org/3.6/library/stdtypes.html#str split (Hint: split on , ') Examples on eturn Value decimal.to.fixed point ('-1 decimal-to-fixed-point 7, 4') decimal-to-fixed-point(,-0.00625,) decimalto.fixed point (-0.0') 1100.001000000000 111.01100110011001100110011 ,-0.00000001100 1 1 0011001100, ,-0.00000000000 000000000000, |

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

Recommended Textbook for

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions

Question

Define the term "Leasing"

Answered: 1 week ago

Question

What do you mean by Dividend ?

Answered: 1 week ago

Question

What is database?

Answered: 1 week ago

Question

What are Mergers ?

Answered: 1 week ago