Comments (2)
Hi - this issue is discussed in the warning in the docstring of the numpy.arange
function; see https://numpy.org/doc/stable/reference/generated/numpy.arange.html
I would recommend following the suggestion there and using np.linspace
in cases like this:
>>> np.linspace(0.02, 0.16, 7, endpoint=False)
array([0.02, 0.04, 0.06, 0.08, 0.1 , 0.12, 0.14])
Alternatively, you can construct your range using integers, and multiply the result by the desired scaling to avoid being subject to the effects of floating point rounding error at the boundaries:
>>> 0.02 * np.arange(1, 8)
array([0.02, 0.04, 0.06, 0.08, 0.1 , 0.12, 0.14])
from numpy.
Closing as duplicate, thanks all!
from numpy.
Related Issues (20)
- BUG: f2py cannot find .mod files automatically for the new meson backend HOT 3
- Strange result running lexsort on array with compound type HOT 3
- BUG: crash from inside highway running the numpy tests with asan on MacOS with Clang15 HOT 7
- DOC: Undocumented behavior in `np.reshape` and `np.transpose` HOT 2
- BUG: unexpected type promotion multiplying a masked array with an integer HOT 2
- No module named 'numpy.core._multiarray_umath' HOT 2
- TYP: Overlapping overloads with incompatible return types HOT 2
- numpy import fails when built for mingw-w64 HOT 6
- ENH: Allow disabling error for `numpy.linalg.inv` when one matrix is singular in a stack
- BUG: Matrix multiplication in windows produces large numerical errors inconsistently in numpy >= 2 HOT 25
- BUG: random segmentation fault in `np.unique` on MacOS (arm64) + numpy 2.0.1 HOT 15
- DOC: Improve fromstring documentation & errors/warnings regarding binary mode HOT 1
- BUG: Disagreement between apt python3-numpy and pypi numpy versions HOT 1
- BUG: np.average unable to specify axes HOT 6
- "assume_sorted" attribute for efficient/fast Numpy set operations (intersect, merge etc.).
- Update vendored meson HOT 2
- BUG: tests depend on availability of fortran compiler HOT 5
- BUG: StringDType Subscript assignment problems
- BUG: dtype changed from float64 to int64 in scipy discrete_rv HOT 10
- BUG: crash in `test_stringdtype.py::test_ufunc_multiply` under free-threaded build
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from numpy.