This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: F String bugs with numpy.float32
Type: behavior Stage: resolved
Components: Versions: Python 3.8
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: PingHGao, mark.dickinson
Priority: normal Keywords:

Created on 2021-04-28 12:44 by PingHGao, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg392192 - (view) Author: GPH (PingHGao) Date: 2021-04-28 12:44
When using F String with numpy.float32 variable, the output is wrong!

Example code:

```python
import numpy as np

floatNumber = 0.00123
print(f"num:{floatNumber}")

npFloatNumber = np.float32(0.00123)
print(f"num:{npFloatNumber}")
```

The output is:

```
num:0.00123
num:0.001230000052601099
```

As we can see, the value of np.float32 is wrong!
msg392193 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2021-04-28 12:56
See https://github.com/numpy/numpy/issues/10645. I'll close here (this tracker is for core Python, and NumPy isn't part of core Python).
History
Date User Action Args
2022-04-11 14:59:44adminsetgithub: 88132
2021-04-28 12:56:02mark.dickinsonsetstatus: open -> closed

nosy: + mark.dickinson
messages: + msg392193

resolution: third party
stage: resolved
2021-04-28 12:44:15PingHGaocreate