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

Add log function to Dec #6090

Merged
merged 2 commits into from
Dec 2, 2023
Merged

Add log function to Dec #6090

merged 2 commits into from
Dec 2, 2023

Conversation

Gungy2
Copy link
Contributor

@Gungy2 Gungy2 commented Nov 25, 2023

This was achieved in a similar manner as other mathematical functions, such as asin.

This closes #5830.

@Gungy2 Gungy2 marked this pull request as draft November 25, 2023 19:25
@Gungy2 Gungy2 marked this pull request as ready for review November 25, 2023 19:33
@Gungy2 Gungy2 marked this pull request as draft November 25, 2023 20:09
@Gungy2 Gungy2 marked this pull request as ready for review November 25, 2023 21:04
@@ -463,6 +463,10 @@ pub const RocDec = extern struct {
return RocDec{ .num = out };
}

pub fn log(self: RocDec) RocDec {
return fromF64(@log(self.toF64())).?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary for this PR, but I just realized that we should probably have a version of fromF64 that just calls roc_panic if it fails instead of generating a zig orelse unreachable. If this happens, we either should properly panic or potentially recover in the log and similar functions.

@bhansconnect bhansconnect merged commit e65f14f into roc-lang:main Dec 2, 2023
16 checks passed
@Gungy2 Gungy2 deleted the 5830 branch December 2, 2023 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add log to Dec
2 participants