Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yairchu/numpy-floats-bug
Chasing after what looks like a strange bug in numpy on M1
https://github.com/yairchu/numpy-floats-bug
Last synced: 23 days ago
JSON representation
Chasing after what looks like a strange bug in numpy on M1
- Host: GitHub
- URL: https://github.com/yairchu/numpy-floats-bug
- Owner: yairchu
- Created: 2024-07-09T08:26:46.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-07-14T18:48:02.000Z (4 months ago)
- Last Synced: 2024-07-15T17:09:10.897Z (4 months ago)
- Language: Assembly
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# numpy bug goose-chase
In this repo I investigated [a bug in numpy](https://github.com/numpy/numpy/issues/26940),
where the same calculation `np.square(vec)` performed again produces different results,
and generally things didn't make sense!Reproduced on Python 3.12.4 numpy=1.26.4 on macOS 14.4.1 M1 Pro.
Didn't repro for me with numpy==2.0.0, nor on Linux/Windows!
To test on your environment:
```bash
python -m venv venv
venv/bin/python -m pip install -r requirements.txtvenv/bin/python floating_point_determinism_test.py
```The common output I get looks like this:
```text
INCONSISTENT!
Difference: [2.5243549e-29+0.j 0.0000000e+00+0.j 0.0000000e+00+0.j]
Using version 1.26.4
```However with `numpy==2.0.0` the valid output comes and looks like this:
```text
Results are consistent.
Difference: [0.+0.j 0.+0.j 0.+0.j]
Using version 2.0.0
```