Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help with my machine learning assignment? 1 (10 points) Convert Decimal Mantissa to Binary Mantissa Write a program that receives a real number in

Please help with my machine learning assignment?

image text in transcribed

1 (10 points) Convert Decimal Mantissa to Binary Mantissa Write a program that receives a real number in decimal (base 10) and converts it into binary (base 2). You must implement the algorithm discussed in Chapter 1. You may not use libraries or built-in functions (e.g., Double.toHexString(...) in Java or "{0:b}.format(...) in Python) You may assume that all input is well-formed (i.e., all inputs are valid real numbers). You need not (and should not) expect illegal inputs (e.g., "0.1LOL"). 1.1 Legal Input Ideally, your program should handle all real numbers including: negative numbers, positive numbers, and those with non-zero integer components. However, you may (without penalty) restrict your expected input to numbers in the domain 0 to (inclusive) to 1 (exclusive)-i.e., 2 (0,1). 1.2 Sample Execution & Output All input must be handled through command line arguments. Suppose you were implementing your solution in a Python 3.7 program, convert_dec_to_bin.py. Program execution should be similar to: ./convert_dec_to_bin.py 0.5 0.25 0.75 The output should take a form similar to: : | Base 10 | Base 2 | ----- 1:------- | 0.5 | 0.1 1 | 0.25 | 0.01 1 | 0.75 | 0.11 If you have a number that repeats, stop after MAX-DIGITS, which should be set as a global constant in your program. I suggest you start with MAX DIGITS = 8

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_2

Step: 3

blur-text-image_3

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

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions