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

Confused on Division Implementation #7

Closed
rmehta33 opened this issue Jun 17, 2024 · 4 comments
Closed

Confused on Division Implementation #7

rmehta33 opened this issue Jun 17, 2024 · 4 comments

Comments

@rmehta33
Copy link

rmehta33 commented Jun 17, 2024

Hello!

More of an implementation question than anything else, buy why does the '/' operation truncate by default?

And if possible, can there instead be two '/' functions? One that keeps the original functionality but returns it as the relevant int type instead, and another that just returns the '.divide' function as a decimal. Or perhaps replace the current function with '÷' and use '/' for '.divide'?

This would just make it much easier to use the package as a drop in replacement for a double. If you agree with the change, I can even create the pull request.

@mgriebling
Copy link
Owner

Sure go ahead.

@mgriebling
Copy link
Owner

Done, I believe.

@mgriebling
Copy link
Owner

To answer your question about the truncation in the '/' division, have a look at the README.md file. It explains the design decisions made. Basically some divisions could result in infinite decimal calculations so this is a practical way of avoiding this situation. A 'divide' function provides additional arguments to allow as much precision as desired during extended calculations.

@rmehta33
Copy link
Author

rmehta33 commented Sep 4, 2024

Hey! Thank you for the follow ups. Yup makes sense. I ended up needing a lot more
relatively niche modifications for my particular use case, so it was just easier to create a fork. But honestly thanks for making and supporting the library, it’s been a big help!

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

No branches or pull requests

2 participants