Skip to content

Commit

Permalink
Merge pull request #18432 from bashtage/clean-c-warnings
Browse files Browse the repository at this point in the history
MAINT: Correct code producing warnings
  • Loading branch information
mattip committed Feb 18, 2021
2 parents 0eb9f54 + 23136aa commit 740a8cf
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion numpy/core/src/multiarray/ctors.c
Original file line number Diff line number Diff line change
Expand Up @@ -2907,7 +2907,7 @@ _arange_safe_ceil_to_intp(double value)
"arange: cannot compute length");
return -1;
}
if (!(NPY_MIN_INTP <= ivalue && ivalue <= NPY_MAX_INTP)) {
if (!((double)NPY_MIN_INTP <= ivalue && ivalue <= (double)NPY_MAX_INTP)) {
PyErr_SetString(PyExc_OverflowError,
"arange: overflow while computing length");
return -1;
Expand Down
2 changes: 1 addition & 1 deletion numpy/core/src/umath/fast_loop_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ abs_ptrdiff(char *a, char *b)
*/
#define IS_OUTPUT_BLOCKABLE_UNARY(esizein, esizeout, vsize) \
((steps[0] & (esizein-1)) == 0 && \
steps[1] == (esizeout) && labs(steps[0]) < MAX_STEP_SIZE && \
steps[1] == (esizeout) && llabs(steps[0]) < MAX_STEP_SIZE && \
(nomemoverlap(args[1], steps[1] * dimensions[0], args[0], steps[0] * dimensions[0])))

#define IS_BLOCKABLE_REDUCE(esize, vsize) \
Expand Down
2 changes: 1 addition & 1 deletion numpy/random/src/distributions/distributions.c
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ RAND_INT_TYPE random_zipf(bitgen_t *bitgen_state, double a) {
* just reject this value. This function then models a Zipf
* distribution truncated to sys.maxint.
*/
if (X > RAND_INT_MAX || X < 1.0) {
if (X > (double)RAND_INT_MAX || X < 1.0) {
continue;
}

Expand Down

0 comments on commit 740a8cf

Please sign in to comment.