@@ -12,7 +12,7 @@ import Base: ==, <, <=, -, +, *, /, ~, isapprox,
1212import Statistics # for _mean_promote
1313import Random: Random, AbstractRNG, SamplerType, rand!
1414
15- import Base. Checked: checked_neg, checked_add, checked_sub, checked_div
15+ import Base. Checked: checked_neg, checked_add, checked_sub, checked_mul, checked_div
1616
1717using Base: @pure
1818
3636 # Q and N typealiases are exported in separate source files
3737# Functions
3838 scaledual,
39- wrapping_neg, wrapping_add, wrapping_sub,
40- saturating_neg, saturating_add, saturating_sub
39+ wrapping_neg, wrapping_add, wrapping_sub, wrapping_mul,
40+ saturating_neg, saturating_add, saturating_sub, saturating_mul
4141
4242include (" utilities.jl" )
4343
@@ -56,6 +56,9 @@ nbitsint(::Type{X}) where {X <: FixedPoint} = bitwidth(X) - nbitsfrac(X) - signb
5656
5757# construction using the (approximate) intended value, i.e., N0f8
5858* (x:: Real , :: Type{X} ) where {X <: FixedPoint } = _convert (X, x)
59+ wrapping_mul (x:: Real , :: Type{X} ) where {X <: FixedPoint } = x % X
60+ saturating_mul (x:: Real , :: Type{X} ) where {X <: FixedPoint } = clamp (x, X)
61+ checked_mul (x:: Real , :: Type{X} ) where {X <: FixedPoint } = _convert (X, x)
5962
6063# constructor-style conversions
6164(:: Type{X} )(x:: X ) where {X <: FixedPoint } = x
0 commit comments