Skip to content

Commit 57de23c

Browse files
authored
fix how arctan2 treats scalars (#546)
1 parent dfed7a8 commit 57de23c

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

code/numpy/vector.c

+7
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,13 @@ MP_DEFINE_CONST_FUN_OBJ_1(vector_atan_obj, vector_atan);
240240
//|
241241

242242
mp_obj_t vector_arctan2(mp_obj_t y, mp_obj_t x) {
243+
if((mp_obj_is_float(y) || mp_obj_is_int(y)) &&
244+
(mp_obj_is_float(x) || mp_obj_is_int(x))) {
245+
mp_float_t _y = mp_obj_get_float(y);
246+
mp_float_t _x = mp_obj_get_float(x);
247+
return mp_obj_new_float(MICROPY_FLOAT_C_FUN(atan2)(_y, _x));
248+
}
249+
243250
ndarray_obj_t *ndarray_x = ndarray_from_mp_obj(x, 0);
244251
COMPLEX_DTYPE_NOT_IMPLEMENTED(ndarray_x->dtype)
245252

code/ulab.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include "user/user.h"
3434
#include "utils/utils.h"
3535

36-
#define ULAB_VERSION 5.1.0
36+
#define ULAB_VERSION 5.1.1
3737
#define xstr(s) str(s)
3838
#define str(s) #s
3939

docs/ulab-change-log.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Thu, 4 Aug 2022
2+
3+
version 5.1.1
4+
5+
fix how arctan2 treats scalars
6+
17
Mon, 25 July 2022
28

39
version 5.1.0

0 commit comments

Comments
 (0)