Skip to content

Add support for micromath#415

Draft
Kaikallon wants to merge 4 commits into
iliekturtles:masterfrom
Kaikallon:master
Draft

Add support for micromath#415
Kaikallon wants to merge 4 commits into
iliekturtles:masterfrom
Kaikallon:master

Conversation

@Kaikallon
Copy link
Copy Markdown

Hello,

First off, I'm a beginner in Rust so I don't expect this PR to be accepted without modifications. Feedback is very welcome.

The reson for adding this support is that I wanted to use uom in an embedded environment without support for std. I need support for trigonometric functions, but I still want to keep the power of unit analysis. This is an attempt at doing that.

One concern that I have about my contribution is that I think that there is too much copy pasting. I have played around with this for a while and I wasn't able to find a different way that works.

@Kaikallon
Copy link
Copy Markdown
Author

I see now that num-traits is an optional feature of micromath. I'm not sure how or if that should be used. Probably because I never understood the purpose of num-traits. Many traits for numeric operations are already defined in the core and standard library.

@Kaikallon
Copy link
Copy Markdown
Author

Another thing that I noticed is that my implementation could be applied to ratio also. Further, there are more functions which could be implemented, such as sqrt()

@Kaikallon Kaikallon marked this pull request as draft May 20, 2023 20:19
@iliekturtles
Copy link
Copy Markdown
Owner

Thanks for the PR! Another possible solution for trig functions on no_std is in #309 and uses libm. I'll compare the two (I just need some patience, I'm well behind on PRs) and see what kind of overlap there is.

I also kicked off the tests, but it looks like there is some bitrot and the latest compiler is causing some errors unrelated to your changes.

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.

2 participants