2023-05-25 11:14:38 -05:00
# question 1: The international standard for floating-point representation is called IEEE 754.
2023-05-25 11:46:29 -05:00
2023-05-25 11:14:38 -05:00
# 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).
2023-05-25 11:46:29 -05:00
2023-05-25 11:14:38 -05:00
# question 3:
import sys
print ( sys . float_info )
2023-05-25 11:46:29 -05:00
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 )
2023-05-25 11:14:38 -05:00
# 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
# represent very large numbers accurately. However, when the result exceeds the limit of a 64-bit signed integer
# (2^63 - 1), an overflow may occur, and the result may not be accurate.
# In the second multiplication (df['Number1'] * df['Number2']), you are using the Pandas multiplication operator
# on the columns of a DataFrame. By default, Pandas uses NumPy for numerical computations, and NumPy uses
# 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
# this limit, it will overflow and wrap around, leading to incorrect results.
2023-05-25 11:46:29 -05:00
2023-05-25 11:14:38 -05:00
# 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.