Skip to content

Commit

Permalink
Add implementations for math.trunc for float32/float64 for cuda target
Browse files Browse the repository at this point in the history
  • Loading branch information
testhound committed Nov 21, 2022
1 parent 2f01c9a commit 25de1a3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions numba/cuda/mathimpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
unarys += [('atanh', 'atanhf', math.atanh)]
unarys += [('tan', 'tanf', math.tan)]
unarys += [('tanh', 'tanhf', math.tanh)]
unarys += [('trunc', 'truncf', math.trunc)]

unarys_fastmath = {}
unarys_fastmath['cosf'] = 'fast_cosf'
Expand Down
9 changes: 9 additions & 0 deletions numba/cuda/tests/cudapy/test_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,15 @@ def test_math_floor(self):
self.unary_template_int64(math_floor, np.floor)
self.unary_template_uint64(math_floor, np.floor)

#---------------------------------------------------------------------------
# test_math_trunc

def test_math_trunc(self):
self.unary_template_float32(math_trunc, np.trunc)
self.unary_template_float64(math_trunc, np.trunc)
self.unary_template_int64(math_trunc, np.trunc)
self.unary_template_uint64(math_trunc, np.trunc)

#---------------------------------------------------------------------------
# test_math_copysign

Expand Down

0 comments on commit 25de1a3

Please sign in to comment.