Update page 'Day 1 homework - Xuanyi Wang (Sloetjes)'
@@ -18,7 +18,7 @@ Single-precision format floating-point numbers are represented using 32 bits, wi
|
||||
|
||||
Double-precision floating-point numbers are represented using 64 bits, with 1 bit for the sign, 11 bits for the exponent, and 52 bits for the significand.
|
||||
|
||||
* The IEEE 754 standard also defines extended-precision and quadruple-precision formats, which use 80 bitsand 128 bits, respectively.
|
||||
* The IEEE 754 standard also defines extended-precision and quadruple-precision formats, which use **80 bits** and **128 bits**, respectively.
|
||||
|
||||
* However, these formats are less commonly used than the single-precision and double-precision formats.
|
||||
|
||||
@@ -58,7 +58,7 @@ print(df)
|
||||
|
||||
#### Answer:
|
||||
|
||||
`num1` and `num2` are both 64-bit integers, which means that ` num1 * num2` is performed using 64-bit integer arithmetic. However,`df[‘Number1’] ` and `df[‘Number2’] ` are Pandas Series objects and they are 64-bit floating point numbers so `df[‘Number1’] * df[‘Number2’] ` is performed using floating-point arithmetic which involves approximations and rounding errors.
|
||||
**`num1`** and **`num2` **are both 64-bit integers, which means that **` num1 * num2`** is performed using 64-bit integer arithmetic. However,**`df[‘Number1’] `** and **`df[‘Number2’] `** are Pandas Series objects and they are 64-bit floating point numbers so **`df[‘Number1’] * df[‘Number2’] `** is performed using floating-point arithmetic which involves approximations and rounding errors.
|
||||
|
||||
#### 1. You can use sys.getsizeof to see how large a Python object is. Does the size of a Python floating-point number change as it gets larger? Why or why not?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user