Division broken when dtype specified
See original GitHub issueIn a head build using python 3:
>>> np.__version__
'1.8.0.dev-069e9b0'
>>> np.divide(.4, 1.0, dtype=np.float)
0.0
>>> np.divide(.4, 1.0)
0.40000000000000002
Issue Analytics
- State:
- Created 10 years ago
- Comments:22 (20 by maintainers)
Top Results From Across the Web
python - Given a date range how can we break it up into N ...
I thought I would speed this up by breaking up the date range into non-overlapping intervals and use multiprocessing on each interval. My ......
Read more >Essential basic functionality — pandas 1.5.2 documentation
pandas offers various functions to try to force conversion of types from the object dtype to other types. In cases where the data...
Read more >NumPy 1.21.0 Release Notes
dtype attribute must return a dtype. A DeprecationWarning is now given if the . dtype attribute of an object passed into np. dtype...
Read more >Pandas Tutorial: Data analysis with Python: Part 2
Other (please specify), What type of cranberry saucedo you typically ... Female 544 Male 481 NaN 33 Name: What is your gender?, dtype:...
Read more >dask.dataframe.read_csv
In some cases it can break up large files: ... If True, all integer columns that aren't specified in dtype are assumed to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
there are still problems with division: https://stackoverflow.com/questions/45278112/numpy-integer-division-sometimes-yields-wrong-results-when-casted
python 3, numpy 1.13.1
Yeah, the lack of a coherent theory about what
dtype
means bothers me too. Defining it to mean “this is the output type I want” would make some sense, and I think actually work if our type resolution code would try to pick the “best” intermediate type instead of casting int64 to float16, but (a) that’s not how our type resolution code works, and (b) I feel like there are cases where dtype is used to indicate intermediate precision or similar.