Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect documentation for BigDecimal#sign #78

Closed
carl-stripe opened this issue Oct 4, 2017 · 0 comments · Fixed by #234
Closed

Incorrect documentation for BigDecimal#sign #78

carl-stripe opened this issue Oct 4, 2017 · 0 comments · Fixed by #234

Comments

@carl-stripe
Copy link

The documentation for BigDecimal#sign is incorrect. It reads:

Returns a positive value if > 0, a negative value if < 0, and a zero if == 0.

* Returns a positive value if > 0, a negative value if < 0, and a
* zero if == 0.

However, this does not match BigDecimal's behavior:

[1] pry(main)> require 'bigdecimal'
=> true
[2] pry(main)> BigDecimal.new("0").sign
=> 1
[3] pry(main)> BigDecimal.new("-0").sign
=> -1

These values match the BigDecimal::SIGN_XXX constants for signed zeroes, which have the values 1 and -1 (neither of which is zero as #sign seems to document)

mrzasa added a commit to mrzasa/bigdecimal that referenced this issue Jul 28, 2022
Fixes ruby#78 by describing behaviour for positive and negative zero in the docs.
@mrkn mrkn closed this as completed in #234 Sep 25, 2022
@mrkn mrkn closed this as completed in 5415b12 Sep 25, 2022
matzbot pushed a commit to ruby/ruby that referenced this issue Sep 25, 2022
Fixes ruby/bigdecimal#78 by describing behaviour for positive and negative zero in the docs.

ruby/bigdecimal@5415b120ab
mrzasa added a commit to mrzasa/bigdecimal that referenced this issue Nov 30, 2022
Fixes ruby#78 by describing behaviour for positive and negative zero in the docs.
mrzasa added a commit to mrzasa/bigdecimal that referenced this issue Dec 16, 2022
Fixes ruby#78 by describing behaviour for positive and negative zero in the docs.
mrzasa added a commit to mrzasa/bigdecimal that referenced this issue Jan 13, 2023
Fixes ruby#78 by describing behaviour for positive and negative zero in the docs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant