@@ -523,10 +523,10 @@ function rdiv_with_overflow(x::FD{T, f}, y::Integer) where {T<:Integer, f}
523523end
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
530530to x, returning it and a boolean indicating whether overflow has occurred.
531531
532532The overflow protection may impose a perceptible performance penalty.
@@ -546,10 +546,10 @@ function ceil_with_overflow(x::FD{T,f}) where {T<:Integer,f}
546546end
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
553553to x, returning it and a boolean indicating whether overflow has occurred.
554554
555555The 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)
565565end
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+ """
567577round_with_overflow (fd:: FD , :: RoundingMode{:Up} ) = ceil_with_overflow (fd)
568578round_with_overflow (fd:: FD , :: RoundingMode{:Down} ) = floor_with_overflow (fd)
569579# trunc cannot overflow.
0 commit comments