-
Notifications
You must be signed in to change notification settings - Fork 99
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
Float documentation and unit tests #455
Conversation
+1 on having an equal with |
Woah that is a huge test file! :) |
Co-authored-by: Kento Sugama <[email protected]>
…ty/motoko-base into luc/improve_float_test_doc
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.
Great stuff - very thorough.
I would file an issue for items at the end of PR description (one blanket one or several smaller, up to you).
/// | ||
/// Float.neq(1.23) // => -1.23 | ||
/// ``` | ||
public func neq(x : Float) : Float { -x }; // Typo: Should be changed to `neg` |
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.
indeed. I guess we could deprecate neq
and add neg
(but also in a separate PR)
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 will prepare that in a separate PR. Good idea to deprecate the misspelled function.
LGTM! Super thorough |
Co-authored-by: Kento Sugama <[email protected]>
Thanks a lot @crusso and @kentosugama for the review of this PR (with this huge unit test file). |
Improve `Float.mo`: * Documentation * Unit tests Issues detected while refactoring: * dfinity/motoko#3646 * dfinity/motoko#3647 Other possible areas of improvements for `Float`: * `isNaN()` function is missing * `equals()` comparison should consider numerical errors, by requiring an epsilon argument. * Positive infinity and negative infinity constants are missing. * `compare` function does not have a total order and is inconsistent, e.g. `compare(NaN, NaN) == #greater`. * `neq` function has a typo. Rename to `neg` The suggestions for improvement are summarized in issue #456
Improve
Float.mo
:Issues detected while refactoring:
nan
(not a number) floating point representation with a negative sign onwasmtime
. motoko#3647Other possible areas of improvements for
Float
:isNaN()
function is missingequals()
comparison should consider numerical errors, by requiring an epsilon argument.compare
function does not have a total order and is inconsistent, e.g.compare(NaN, NaN) == #greater
.neq
function has a typo. Rename toneg
The suggestions for improvement are summarized in issue #456