-
Notifications
You must be signed in to change notification settings - Fork 18
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
Math migration #18
Math migration #18
Conversation
README.md
Outdated
@@ -59,6 +59,122 @@ true | |||
false | |||
``` | |||
|
|||
Remainder: |
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 realise that the readme already had examples in, but I think examples should go into the doc-comments instead, so that they can be seen on Pursuit.
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 agree about examples in the doc-comments. I'd be happy to completely rework the README to give a shorter and more general overview of the functions Data.Number supports but that will mean changing what was already there before this 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.
That sounds good to me, thanks!
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.
After some delay (my apologies), this should now be resolved in 626e299
README.md
Outdated
|
||
Trignometric functions: | ||
```purs | ||
> sin 0.0 |
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.
We have an opportunity to clarify that sin takes radians here; how about using pi/2 as the value?
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 agree but I missed this in the last commit. I'll fix shortly.
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.
Fixed in 73c1e25
Co-authored-by: Harry Garrood <harry@garrood.me>
Co-authored-by: Harry Garrood <harry@garrood.me>
@hdgarrood Over on purescript/purescript#2980 you express hesitancy on polyfills that mutate the Math object. This repo contains a polyfill for
That doesn't look to me like it mutates the Math object but I'm certainly no expert on Javascript. If you have concerns over |
No, that looks fine! That won’t mutate Math, it’ll just use Math.sign if it exists and otherwise it’ll use the polyfill. |
One final tweak. I've switched |
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.
LGTM!
As noted in the Math issue (my comment), we need to decide whether to replicate more functions added to the Math object in ES6.
🏓 @thomashoneyman This should be ready to go now. |
I haven't been involved in these discussions, so I'd appreciate if perhaps @hdgarrood could take another look. If not, I can review, but I don't necessarily have the correct background to make these decisions. |
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 have a couple of minor docs suggestions but this look great 👍
src/Data/Number.purs
Outdated
|
||
-- | Returns `e` exponentiated to the power of the argument. | ||
-- | ```purs | ||
-- | > exp 0.0 |
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 feel like exp 1.0
might be a better example here; any function of the form \x -> pow a x
for some a
is going to take 0.0
to 1.0
.
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.
Fixed in latest commit.
src/Data/Number.purs
Outdated
|
||
-- | Returns the natural logarithm of a number. | ||
-- | ```purs | ||
-- | > log 1.0 |
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 here - maybe log e
would be more illustrative here? I realise you have that same example on the documentation for e
but I think repetition here is fine, especially as people might be linked directly to the documentation for exp
and log
and not see e
.
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.
Fixed in latest commit.
Introduces many of the functions currently living in purescript-math. Closes #17. See also purescript-deprecated/purescript-math#31.
Checklist: