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
Enhanced RDoc for Float #5144
Enhanced RDoc for Float #5144
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good. I think for the basic mathematical operators, we should reduce the number of examples, see inline comments.
numeric.c
Outdated
@@ -991,7 +1004,6 @@ flo_to_s(VALUE flt) | |||
} | |||
else if (isnan(value)) | |||
return rb_usascii_str_new2("NaN"); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, please avoid making non-documentation changes during documentation updates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good. I think for the basic mathematical operators, we should reduce the number of examples, see inline comments.
Don't agree on this one. I think it's worth reminding that the result may not be a Float, and in particular that it may be Infinity, -Infinity, or NaN. Maybe the call-seqs should be changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, please avoid making non-documentation changes during documentation updates.
A mistake; will correct. Thanks for noticing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't object to the example showing the return of Complex result. I don't think it makes sense to include Infinite/NaN example results for every method. Those should be considered similar to exceptions, and we don't provide examples for exceptions per the documentation guide.
numeric.c
Outdated
* f + 1.0 # => 4.140000000000001 | ||
* f + Rational(1, 1) # => 4.140000000000001 | ||
* f + Complex(1, 0) # => (4.140000000000001+0i) | ||
* f + Float::MAX # => 1.7976931348623157e+308 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these last 4 examples can be dropped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
numeric.c
Outdated
* f - 1.0 # => 2.14 | ||
* f - Rational(1, 1) # => 2.14 | ||
* f - Complex(1, 0) # => (2.14+0i) | ||
* f - (Float::MAX * 2) # => -Infinity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, these last three examples can be dropped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
numeric.c
Outdated
* f * 2.0 # => 6.28 | ||
* f * Rational(1, 2) # => 1.57 | ||
* f * Complex(2, 0) # => (6.28+0.0i) | ||
* f * Float::MAX # => Infinity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for these last three examples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
numeric.c
Outdated
* f / 2.0 # => 1.57 | ||
* f / Rational(2, 1) # => 1.57 | ||
* f / Complex(2, 0) # => (1.57+0.0i) | ||
* f / 0 # => Infinity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And these last three examples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
@jeremyevans, ready for review/approval. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
@jeremyevans, back in the day I wrote thousands and thousands of lines of i860 assembler code for vector-concurrent double-precision numerical functions. So NaN etc. are old and dear friends. :) |
Treats: