Path: blob/master/material/binary-representation.ipynb
934 views
#Task 3
This homework is an activity intended to practice IPython notebooks and binary representation of real numbers.
Due to: Nov 15
##Binary Representation
According to the IEEE 754-2008 standard, binary representation of real numbers may be done by using single-precision float32 or double-precision float64. float32 follows the next rules:
The fist digit (called s) indicates the sign of the number (s=0 means a positive number, s=1 a negative one).
The next 8 bits represent the exponent of the number.
The last 23 bits represent the fractional part of the number.
The formula for recovering the real number is then given by:
where is the sign, the fraction bits and is given by:
1. Write an IPython notebook and present (consult) the steps necessary for finding the binary float32 representation of a real number.
2. Write a routine (same notebook) that calculates the binary representation of a number following the steps of the previous item. Test your results with the next function number32
, i.e., if your routine is called binary32
, running number32( binary32( number ) )
should return the original number.
Advice: take advantage of all the taught functionalities of IPython notebooks, i.e., Markdown formatting, embedded code, LaTeX formatting, etc.