Recall & Review
beginner
What is a float16 type in numpy?
Float16 is a 16-bit floating-point number type in numpy. It uses less memory but has lower precision and smaller range compared to float32 and float64.
Click to reveal answer
beginner
How does float32 differ from float64 in numpy?
Float32 uses 32 bits to store a floating-point number, offering a balance between memory use and precision. Float64 uses 64 bits, providing higher precision and a larger range but uses more memory.
Click to reveal answer
intermediate
Why choose float16 over float64 in numpy?
Choose float16 when memory is limited and you can accept lower precision. It is useful for large arrays where saving memory is more important than exact precision.
Click to reveal answer
intermediate
What happens if you perform calculations mixing float16 and float64 in numpy?
Numpy will upcast to the higher precision type (float64) to avoid losing precision during calculations.
Click to reveal answer
beginner
How can you check the data type of a numpy array?
Use the `.dtype` attribute of the numpy array to see its data type, for example: `array.dtype`.
Click to reveal answer
Which numpy float type uses the least memory?
✗ Incorrect
Float16 uses 16 bits, which is less memory than float32 (32 bits) and float64 (64 bits).
What is the main advantage of float64 over float32?
✗ Incorrect
Float64 provides higher precision and can represent larger or smaller numbers than float32.
If you add a float16 and a float64 numpy array, what will be the result type?
✗ Incorrect
Numpy upcasts to the higher precision type, so the result will be float64.
Which float type is best for saving memory when precision is less important?
✗ Incorrect
Float16 uses the least memory and is suitable when precision can be sacrificed.
How do you find the data type of a numpy array named 'arr'?
✗ Incorrect
The `.dtype` attribute shows the data type of a numpy array.
Explain the differences between float16, float32, and float64 in numpy.
Think about how memory and precision trade off among these types.
You got /4 concepts.
Describe what happens when numpy performs operations on arrays with different float types.
Consider how numpy avoids losing precision in mixed-type calculations.
You got /3 concepts.