Platek

****************************************
 Assignment for 5/10:
****************************************
1. Summer program for young women:

   http://mailchi.mp/poly/for-young-women-study-computer-science-this-summer-at-nyu?e=3d697c3714


2. Review the floating point tutorial located at this link:

  https://support.microsoft.com/en-us/help/42980/-complete-tutorial-to-understand-ieee-floating-point-errors


3. Write a python script to find the terms of the series that floating point numbers
   use to approximate a fractional part of a real number.

   Prompt the user for a positive real number less than 1. Then print a list of all the terms
   used to approximate the real number.

   Each term of the approximation series has the form 1/2**n where n is a positive integer.
   The sum of the series is the best available approximation of the real number.

   Example:

    x (the input)             output(list of terms)
    ==============           =======================
    0.5                                   ['1/2']
    0.75                                 ['1/2','1/4']
    0.1                                   ['1/16', '1/32', '1/256', '1/512', '1/4096', '1/8192', '1/65536', '1/131072', '1/1048576',
                                             '1/2097152', '1/16777216', '1/33554432', '1/268435456', '1/536870912', '1/4294967296',
                     '1/8589934592', '1/68719476736', '1/137438953472', '1/1099511627776', '1/2199023255552',
                     ' 1/17592186044416', '1/35184372088832', '1/281474976710656', '1/562949953421312',
                     '1/4503599627370496', '1/9007199254740992', '1/36028797018963968']
    
    

     Recall that if the user enters the real number : 0.1
     then this number, represented in float-point precision, is :

         0.1000000000000000055511151231257827021181583404541015625 (55 decimal places).
      
    The sum of the terms in your list should match this value.

Comments