In this we are going to see a basic program to print floating point from exponent pair and mantessia in Python Programming Language.
import math
def print_float():
print('{:^7} {:^8} {:^17}'.format('Mantissa', 'Exponent', 'Floating point value'))
print('{:-^8} {:-^8} {:-^20}'.format('', '', ''))
for m, e in [ (0.7, -3),
(0.3, 0),
(0.5, 3),
]:
x = math.ldexp(m, e)
print('{:7.2f} {:7d} {:7.2f}'.format(m, e, x))
print_float()
# Code By DHIRAJ SHELKE
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP