HW1_shunan_zhao

This commit is contained in:
2023-05-25 11:46:29 -05:00
parent b4f174be47
commit 5d36a06987
+5 -1
View File
@@ -1,9 +1,12 @@
# question 1: The international standard for floating-point representation is called IEEE 754. # question 1: The international standard for floating-point representation is called IEEE 754.
# question 2: The IEEE 754 standard allows floating-point numbers to be represented with different bit sizes. The most commonly used formats specified by the standard are single precision (32 bits) and double precision (64 bits). # question 2: The IEEE 754 standard allows floating-point numbers to be represented with different bit sizes. The most commonly used formats specified by the standard are single precision (32 bits) and double precision (64 bits).
# question 3: # question 3:
import sys import sys
print(sys.float_info) print(sys.float_info)
sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1)represented using 64 bits. sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1)
# question 4: In the first multiplication (num1 * num2), you are using the normal Python multiplication # question 4: In the first multiplication (num1 * num2), you are using the normal Python multiplication
# operator, which operates on native Python integers. Python integers have arbitrary precision, meaning they can # operator, which operates on native Python integers. Python integers have arbitrary precision, meaning they can
# represent very large numbers accurately. However, when the result exceeds the limit of a 64-bit signed integer # represent very large numbers accurately. However, when the result exceeds the limit of a 64-bit signed integer
@@ -13,5 +16,6 @@ sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.
# fixed-size data types. In this case, the integers in the DataFrame are most likely represented as 64-bit # fixed-size data types. In this case, the integers in the DataFrame are most likely represented as 64-bit
# signed integers (int64), which have a maximum value of 2^63 - 1. If the result of the multiplication exceeds # signed integers (int64), which have a maximum value of 2^63 - 1. If the result of the multiplication exceeds
# this limit, it will overflow and wrap around, leading to incorrect results. # this limit, it will overflow and wrap around, leading to incorrect results.
# Question5: 5. The size of a Python floating-point number is determined by the implementation and is not influenced by the magnitude of the value it represents. So it does not change as the value of the number gets larger. # Question5: 5. The size of a Python floating-point number is determined by the implementation and is not influenced by the magnitude of the value it represents. So it does not change as the value of the number gets larger.