Closed
Description
There's something odd going on with ulab.numerical.min
and ulab.numerical.max
with the int16 data type. Example below from nRF52840-based CLUE:
Adafruit CircuitPython 5.3.0 on 2020-04-29; Adafruit CLUE nRF52840 Express with nRF52840
>>> import ulab
>>> import ulab.numerical
>>> length=6
>>> someint16s = ulab.array([0, 12345, 23456, -20_000, -30_000, 0], dtype=ulab.int16)
>>> ulab.numerical.min(someint16s)
0
>>> ulab.numerical.max(someint16s)
-20000
I'd expect -30000
and 23456
out of those. Converting to float
type:
>>> somefloats = ulab.array(someint16s)
>>> type(somefloats)
<class 'ndarray'>
>>> somefloats
array([0.0, 12345.0, 23456.0, -20000.0, -30000.0, 0.0], dtype=float)
>>> ulab.numerical.min(somefloats)
-30000.0
>>> ulab.numerical.max(somefloats)
23456.0
And everything's fine.
Perhaps worth checking all the non float data types?
Metadata
Metadata
Assignees
Labels
No labels