Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

4. Find the IEEE 754 representation of the numbers in the table i.e. creat«e thi

ID: 3755651 • Letter: 4

Question

4. Find the IEEE 754 representation of the numbers in the table i.e. creat«e this table and fill it out in Jupyter notebook with the necessary conver- sions, the sign bits, exponents and mantissa. You can pick two integers of your choice for the last two rows. I must be able to see your work in detail. Don't skip steps here. Use the LaTeX capability of the markdown cells in Jupyter notebook. For the conversions, work them out by hand and show me the details of the calculation. Then show that the results are correct using the Python built in conversions for the binary and decimal types for at least one case each for decimal to binary and binary to decimal respectively

Explanation / Answer

def createTableFile (out_tb1, dataList, fields2Add, arcpy):  
Requires:
out_tb1 output feature class name "c:/temp/myfile.dbf"
dataList a list of lists of data eg.
[[data list 1],[data list 2]...[data list n]]
or [[data list 1]]
arcpy the Geoprocessor Object
Returns:
Create the output table and returns a message (msg)
'''  
fulname = os.path.split(out_tb1)  
out_folder = fulname[0].replace("\","/")  
out_fname = fulname[1].replace(" ", "_")  
outFullName = out_folder + "/" + out_fname  
message = " "  
try:  
arcpy.CreateTable_management(out_folder, out_fname)  
message += " Creating: " + str(out_fname)  
except:  
message += " Failed to create feature class: " + arcpy.GetMessages()  
return message  
for aField in fields2Add:  
message += " Adding field: " + str(aField)  
try:  
arcpy.AddField_management(outFullName, aField[0], aField[1], aField[2], aField[3])  
except:  
message += " Failed to add field: " + aField[0] + " " +arcpy.GetMessages()
try:  
cur = arcpy.InsertCursor(out_tb1)  
except:  
message += "Failed to create cursor"  
return message  
anID=0  
for i in range(0,len(dataList)):  
values = dataList[i]  
a_row = cur.newRow()  
for j in range(0, len(values)):  
a_row.setValue(fields2Add[j][0],values[j])  
cur.insertRow(a_row)  
del a_row  
del cur  
message += " Processing complete"  
return message  
if __name__ == "__main__":  
import sys, os  
import arcpy  
arcpy.env.overwriteOutput = True  
outDBF = "C:/temp/testdbf.dbf"   
if os.path.exists(outDBF):  
os.remove(outDBF)   
dataList = [[1,1,1,"a"],[2,2,2,"b"],[3,3,3,"c"],[4,4,4,"d"],[5,5,5,"e"]]  
fields2Add = [["X", "double", 14, 7],  
["Y", "double", 14, 7],  
["Z", "double", 14, 7],  
["TextFld", "text", 20,""]]  
message = createTableFile(outDBF, dataList, fields2Add, arcpy)  
print message  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote