Skip to content

Commit f45fb68

Browse files
authored
Add missing docstring for round_with_overflow (#115)
1 parent 26c0a19 commit f45fb68

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/FixedPointDecimals.jl

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,10 +523,10 @@ function rdiv_with_overflow(x::FD{T, f}, y::Integer) where {T<:Integer, f}
523523
end
524524

525525
# Does not exist in Base.Checked, so just exists in this package.
526-
@doc """
526+
"""
527527
FixedPointDecimals.ceil_with_overflow(x::FD)::Tuple{FD,Bool}
528528
529-
Calculates the nearest integral value of the same type as x that is greater than or equal
529+
Calculate the nearest integral value of the same type as x that is greater than or equal
530530
to x, returning it and a boolean indicating whether overflow has occurred.
531531
532532
The overflow protection may impose a perceptible performance penalty.
@@ -546,10 +546,10 @@ function ceil_with_overflow(x::FD{T,f}) where {T<:Integer,f}
546546
end
547547

548548
# Does not exist in Base.Checked, so just exists in this package.
549-
@doc """
549+
"""
550550
FixedPointDecimals.floor_with_overflow(x::FD)::Tuple{FD,Bool}
551551
552-
Calculates the nearest integral value of the same type as x that is less than or equal
552+
Calculate the nearest integral value of the same type as x that is less than or equal
553553
to x, returning it and a boolean indicating whether overflow has occurred.
554554
555555
The overflow protection may impose a perceptible performance penalty.
@@ -564,6 +564,16 @@ function floor_with_overflow(x::FD{T, f}) where {T, f}
564564
return (reinterpret(FD{T, f}, backing), overflowed)
565565
end
566566

567+
# Does not exist in Base.Checked, so just exists in this package.
568+
"""
569+
FixedPointDecimals.round_with_overflow(x::FD, mode=RoundNearest)::Tuple{FD,Bool}
570+
571+
Calculate the nearest integral value of the same type as x, breaking ties using the
572+
specified RoundingModes, returning it and a boolean indicating whether overflow has
573+
occurred.
574+
575+
The overflow protection may impose a perceptible performance penalty.
576+
"""
567577
round_with_overflow(fd::FD, ::RoundingMode{:Up}) = ceil_with_overflow(fd)
568578
round_with_overflow(fd::FD, ::RoundingMode{:Down}) = floor_with_overflow(fd)
569579
# trunc cannot overflow.

0 commit comments

Comments
 (0)