Skip to content

Conversation

@jmkuhn
Copy link
Collaborator

@jmkuhn jmkuhn commented Feb 18, 2018

Add single argument methods for trunc, floor, and ceil.

@jmkuhn
Copy link
Collaborator Author

jmkuhn commented Feb 18, 2018

CI failures unrelated.

src/DecFP.jl Outdated
@eval Base.reinterpret(::Type{$Ti}, x::$BID) = x.x
end # widths w

Base.round(x::DecimalFloatingPoint, ::RoundingMode{:FromZero}) = (x>=0 ? ceil(x) : floor(x))
Copy link
Member

@stevengj stevengj Mar 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably faster to check signbit(x) ? floor(x) : ceil(x) rather than x >= 0.

(No need for parens around the … ? … : …, either.)

@jmkuhn
Copy link
Collaborator Author

jmkuhn commented Mar 24, 2018

Rebased for xchk macros.

@stevengj stevengj merged commit b9fcccc into JuliaMath:master Mar 25, 2018
@jmkuhn jmkuhn deleted the rounddfp branch March 25, 2018 17:42
@jmkuhn jmkuhn mentioned this pull request Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants