-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
🎨 [New Terms]: Java Math Methods: logarithmic functions
(#902)
#1181
Conversation
🐛 add: Java Math-methods: `.log10()` (Codecademy#902) :bug: add: Java Math-methods: `.log10()` (Codecademy#902)
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.
@tanishq-singh-2301, I did a first review and left some comments.
- 'paths/computer-science' | ||
--- | ||
|
||
The **`java.lang.Math.log()`** method returns `ln a`, the natural logarithm of a. |
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.
The **`java.lang.Math.log()`** method returns `ln a`, the natural logarithm of a. | |
The **`.log()`** method returns `ln a`, the natural logarithm of a. |
|
||
## Example | ||
|
||
The following example demonstrates using `.log()` to find natural logs of: |
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.
The following example demonstrates using `.log()` to find natural logs of: | |
The following example demonstrates using `.log()` to find natural logs: |
|
||
## Codebyte Example | ||
|
||
The following example is runnable and return `ln a`: |
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.
The following example is runnable and return `ln a`: | |
The following example is runnable and returns `ln a`: |
- 'paths/computer-science' | ||
--- | ||
|
||
The **`java.lang.Math.log10()`** method returns `log a`, the logarithm of `a` with base 10. |
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.
The **`java.lang.Math.log10()`** method returns `log a`, the logarithm of `a` with base 10. | |
The **`.log10()`** method returns `log a`, the logarithm of `a` with base 10. |
|
||
## Example | ||
|
||
The following example demonstrates using `.log10()` to find logs (with base 10) of: |
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.
The following example demonstrates using `.log10()` to find logs (with base 10) of: | |
The following example demonstrates using `.log10()` to find logs (with base 10): |
|
||
```shell | ||
The result of log10(10) is: 1 | ||
The result of log10(-6) is: 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.
The result of log10(-6) is: NaN | |
The result of log10(-6.0) is: NaN |
```shell | ||
The result of log10(10) is: 1 | ||
The result of log10(-6) is: NaN | ||
The result of log10(0) is: -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.
The result of log10(0) is: -Infinity | |
The result of log10(0.0) is: -Infinity |
This will produce the following output: | ||
|
||
```shell | ||
The result of log(10) is: 2.303 |
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.
The result of log(10) is: 2.303 | |
The result of log(10.0) is: 2.302585092994046 |
|
||
```shell | ||
The result of log(10) is: 2.303 | ||
The result of log(-6) is: 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.
The result of log(-6) is: NaN | |
The result of log(-6.0) is: NaN |
```shell | ||
The result of log(10) is: 2.303 | ||
The result of log(-6) is: NaN | ||
The result of log(0) is: -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.
The result of log(0) is: -Infinity | |
The result of log(0.0) is: -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.
@tanishq-singh-2301, this looks ready for review two.
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.
Hey @tanishq-singh-2301, I have finished the review of your entry and left some comments. 😁
- 'paths/computer-science' | ||
--- | ||
|
||
The **`.log()`** method returns `ln a`, the natural logarithm of a. |
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.
The **`.log()`** method returns `ln a`, the natural logarithm of a. | |
The **`Math.log()`** method returns the natural logarithm of a number. |
Math.log(a); | ||
``` | ||
|
||
- The `.log()` method takes one parameter `a`. |
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.
- The `.log()` method takes one parameter `a`. | |
The `Math.log()` method takes one parameter `a`. |
``` | ||
|
||
- The `.log()` method takes one parameter `a`. | ||
- If `a` is `NaN`, then return value is `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.
- If `a` is `NaN`, then return value is `NaN`. | |
If `a` is `NaN`, the return value is `NaN`. |
|
||
- The `.log()` method takes one parameter `a`. | ||
- If `a` is `NaN`, then return value is `NaN`. | ||
- If `a` is `negative number`, then return value is `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.
- If `a` is `negative number`, then return value is `NaN`. | |
If `a` is a negative number, the return value is `NaN`. |
- The `.log()` method takes one parameter `a`. | ||
- If `a` is `NaN`, then return value is `NaN`. | ||
- If `a` is `negative number`, then return value is `NaN`. | ||
- If `a` is `positive number`, then return value is `double`. |
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.
- If `a` is `positive number`, then return value is `double`. | |
If `a` is a positive number, the return value is a `double`. |
@@ -0,0 +1,71 @@ | |||
--- | |||
Title: '.log()' |
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.
Title: '.log()' | |
'Math.log()' |
Math.log(a); | ||
``` | ||
|
||
- The `.log()` method takes one parameter `a`. |
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.
This line is not necessary as the function has been previously explained.
Math.log1p(a); | ||
``` | ||
|
||
- The `.log1p()` method takes one parameter `a`. |
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.
This line is not necessary as this function has been explained previously.
``` | ||
|
||
- The `.log1p()` method takes one parameter `a`. | ||
- If `a` is `NaN`, then return value is `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.
Lines 23-27 should be the same as the ones in the entry for the previous two functions.
|
||
## Example | ||
|
||
The following example demonstrates using `.log1p()` to find natural logs: |
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.
The following example demonstrates using `.log1p()` to find natural logs: | |
The following example demonstrates using `Math.log1p()` to find natural logs: |
Hey @tanishq-singh-2301 did you have any questions or need any help with implementing the latest round of feedback? As a reminder, today is the last today to merge your PRs and have them count toward Hacktoberfest. 👀 |
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!
@tanishq-singh-2301 This looks ready to merge. I just made some changes across many commits prior to merging (cc: @HishamT @SSwiniarski):
|
👋 @tanishq-singh-2301 |
Congrats and thank you so much for contributing to Codecademy Docs, @tanishq-singh-2301! 🚀 🥳 The entries should now be live.
Looking forward to your next contribution to Docs! 😄 |
Hey @tanishq-singh-2301! 👋🏻 I was wondering if you'd be open to creating a new PR to make some edits to the 3 entries you recently contributed?
|
sure! |
There pr-link. |
Description
Type of Change
Checklist
main
branch.