Не подтверждена Коммит e767e51d создал по автору Dealga McArdle's avatar Dealga McArdle Зафиксировано автором GitHub
Просмотр файлов

tested int casting (#4338)

владелец f1fe4c12
...@@ -36,15 +36,14 @@ def range_step_stop(start, stop, step, n_type, out_numpy): ...@@ -36,15 +36,14 @@ def range_step_stop(start, stop, step, n_type, out_numpy):
def range_stop_count(start, stop, count, n_type, out_numpy): def range_stop_count(start, stop, count, n_type, out_numpy):
''' Gives count total values in [start,stop] ''' ''' Gives count total values in [start,stop] '''
# we are casting to int here because the input can be floats. # we are casting to int here because the input can be floats.
result = np.linspace(start, stop, num=count, dtype=n_type) result = np.linspace(start, stop, num=int(count), dtype=n_type)
return result if out_numpy else result.tolist() return result if out_numpy else result.tolist()
def range_step_count(start, step, count, n_type, out_numpy): def range_step_count(start, step, count, n_type, out_numpy):
''' Gives count values with step from start''' ''' Gives count values with step from start'''
stop = start + step * (count-1) stop = start + step * (count-1)
result = np.linspace(start, stop, num=count, dtype=n_type) result = np.linspace(start, stop, num=int(count), dtype=n_type)
return result if out_numpy else result.tolist() return result if out_numpy else result.tolist()
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать