bigdecimal icon indicating copy to clipboard operation
bigdecimal copied to clipboard

BigDecimal#whole?

Open dorianmariecom opened this issue 1 year ago • 6 comments

e.g. round == self

Would be nice for things like skiping the .0 in 1.0

dorianmariecom avatar Mar 03 '24 13:03 dorianmariecom

And #whole would be alias of #round or #floor or #ceil or #truncate

dorianmariecom avatar Mar 03 '24 14:03 dorianmariecom

@dorianmariecom What specific changes are you proposing and how do you suggest we implement them? I'm having difficulty understanding from your current explanation, so could you please provide more detailed clarification?

mrkn avatar May 04 '24 14:05 mrkn

e.g.

class BigDecimal
  def whole
    round
  end

  def whole?
    whole == self
  end
end

So a whole method to get the whole part of a number and whole? to see if that number is whole

dorianmariecom avatar May 06 '24 19:05 dorianmariecom