From 3b7e4dbe4886aa26265dff53d8e4718c00fa3385 Mon Sep 17 00:00:00 2001 From: Lorenzo Contento Date: Wed, 13 Apr 2022 13:52:20 +0200 Subject: [PATCH] specialize signbit(::FixedDecimal) faster than the default implementation for BigInts and Int128s --- src/FixedPointDecimals.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/FixedPointDecimals.jl b/src/FixedPointDecimals.jl index 5856d23..49a092c 100644 --- a/src/FixedPointDecimals.jl +++ b/src/FixedPointDecimals.jl @@ -354,6 +354,9 @@ Base.eps(x::FD) = eps(typeof(x)) Base.floatmin(::Type{T}) where {T <: FD} = eps(T) Base.floatmax(::Type{T}) where {T <: FD} = typemax(T) +# the default implementation of signbit is slow for BigInts and Int128s +Base.signbit(x::FD) = signbit(x.i) + # printing function Base.print(io::IO, x::FD{T, 0}) where T print(io, x.i)