Repository navigation
Description
I discovered this while working #2505, we aren't correctly handing uint scalars.
Our tests are catching this because I didn't choose the value of the uint scalar very well, so it's being treated as an integer
arkouda/tests/operator_tests.py
Line 31 in eeebe70
| scalars = {"int64": 5, "uint64": np.uint64(5), "float64": 3.14159, "bool": True} |
if we update this to have
"uint64": np.uint64(2**63 + 1), we start seeing these incorrect results.
Before updating the test:
# ops not implemented by numpy or arkouda: 114
# ops implemented by numpy but not arkouda: 135
# ops implemented by arkouda but not numpy: 4
# ops implemented by both: 611
Matching results: 611 / 611
Arkouda execution errors: 0 / 611
Dtype mismatches: 0 / 611
Value mismatches: 0 / 611
After updating the test:
# ops not implemented by numpy or arkouda: 122
# ops implemented by numpy but not arkouda: 147
# ops implemented by arkouda but not numpy: 6
# ops implemented by both: 589
Matching results: 586 / 589
Arkouda execution errors: 0 / 589
Dtype mismatches: 2 / 589
int64(array) + uint64(scalar): float64(np) vs. int64(ak)
int64(array) - uint64(scalar): float64(np) vs. int64(ak)
Value mismatches: 1 / 589
uint64(scalar) % float64(array): np: [ nan 2.84217094e-14 2.84217094e-14 2.84217094e-14
2.84217094e-14 6.22222222e-01 2.84217094e-14 7.30158730e-01
2.84217094e-14 0.00000000e+00]
ak: [nan 0. 0. 0. 0. 0. 0. 0. 0. 0.]
So we some combinations involving uint scalars that have appeared to be working, but are actually incorrect.
I found this by running ak.arange(10) + np.uint(2**63 + 1). We should return a float array to match numpy but we aren't. The updated tests shows this int64(array) + uint64(scalar): float64(np) vs. int64(ak)
We also have some operations that we thought supported uint scalars, but don't. We can see that by the number of ops implemented by numpy but not arkouda increasing
Fiinally we see there's a value mismatch with uint scalar % float array
Activity
stress-tess commentedon Jun 21, 2023
updating the uint arrays to have better examples as well we see more mismatches
Fixes Bears-R-Us#2508: Fixes `uint` scalar handling
Fixes Bears-R-Us#2508: Fixes `uint` scalar handling
Fixes Bears-R-Us#2508: Fixes `uint` scalar handling
Fixes #2508 and #2519: Fixes `uint` scalar handling and overhauls `mo…