28 lines
1.0 KiB
Python
28 lines
1.0 KiB
Python
# Question 1:
|
|
# The international standard for floating-point representation is
|
|
# called the "IEEE 754 Standard for Floating-Point Arithmetic."
|
|
|
|
# Question 2:
|
|
# 32-bit and 64-bit formats are the most widely used ones in practice.
|
|
|
|
# Question 3:
|
|
# My computer supports all these formats
|
|
import numpy as np
|
|
|
|
supported_formats = np.finfo(np.float32).bits, np.finfo(np.float64).bits
|
|
print(f"Your computer supports the following floating-point formats: {supported_formats}")
|
|
|
|
|
|
# Question 4:
|
|
# Using the Pandas multiplication operator (df['Number1'] * df['Number2'])
|
|
# , the result is automatically converted to a floating-point data type.
|
|
# On the other hand, when I multiply the numbers using the normal Python
|
|
# multiplication operator (num1 * num2), the result remains an integer
|
|
# data type.
|
|
|
|
# Question 5:
|
|
# The size of a floating-point number in memory is primarily determined
|
|
# by the data type and not the actual value it represents. So the size
|
|
# of a Python floating-point number does not change as it gets larger.
|
|
import sys
|
|
print(sys.getsizeof(70)) |