Skip to content

Commit e8e044b

Browse files
dlesnoffZoomRmc
andauthored
Update maths/abs.nim
Co-authored-by: Zoom <[email protected]>
1 parent 571a578 commit e8e044b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

maths/abs.nim

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ runnableExamples:
88
doAssert absMax(@[-1, 2, -3]) == 3
99
doAssert absMaxSort(@[3, -10, -2]) == -10
1010

11-
func absVal(num: float): float =
12-
## Returns the absolute value of a number.
11+
func absVal[T: SomeFloat](num: T): T =
12+
## Returns the absolute value of a number.
13+
## Use `math.abs <https://nim-lang.org/docs/system.html#abs%2CT>`_ instead!
1314
return if num < 0.0: -num else: num
1415

1516
# Same for integers but return a Natural

0 commit comments

Comments
 (0)