@@ -45,10 +45,6 @@ rawtype(::Type{X}) where {T, X <: FixedPoint{T}} = T
4545# construction using the (approximate) intended value, i.e., N0f8
4646* (x:: Real , :: Type{X} ) where {X<: FixedPoint } = X (x)
4747
48- # comparison
49- == (x:: T , y:: T ) where {T <: FixedPoint } = x. i == y. i
50- < (x:: T , y:: T ) where {T <: FixedPoint } = x. i < y. i
51- <= (x:: T , y:: T ) where {T <: FixedPoint } = x. i <= y. i
5248"""
5349 isapprox(x::FixedPoint, y::FixedPoint; rtol=0, atol=max(eps(x), eps(y)))
5450
@@ -128,12 +124,17 @@ for f in (:zero, :oneunit, :one, :eps, :rawone, :rawtype, :floattype)
128124 $ f (x:: FixedPoint ) = $ f (typeof (x))
129125 end
130126end
131- for f in (:div , :fld , :fld1 )
127+ for f in (:( == ), : < , : <= , : div , :fld , :fld1 )
132128 @eval begin
133129 $ f (x:: X , y:: X ) where {X <: FixedPoint } = $ f (x. i, y. i)
134130 end
135131end
136- for f in (:rem , :mod , :mod1 , :min , :max )
132+ for f in (:- , :~ , :abs )
133+ @eval begin
134+ $ f (x:: X ) where {X <: FixedPoint } = X ($ f (x. i), 0 )
135+ end
136+ end
137+ for f in (:+ , :- , :rem , :mod , :mod1 , :min , :max )
137138 @eval begin
138139 $ f (x:: X , y:: X ) where {X <: FixedPoint } = X ($ f (x. i, y. i), 0 )
139140 end
0 commit comments