Replies: 2 comments 3 replies
-
Honestly, even today after switching to The reason why I ended up with BigFloat is that, of course it'll build stuff that will be useless for the project, but they are relatively minimal compared to other dependencies I have seen, as BigFloat doesn't have any dependency itself. I have been thinking a lot about introducing my own type of bigint/bigfloat but that is hassle that other project have tackled for this particular reason, which is why there are crates for that. However, even the current implementation of bigfloat is suboptimal, as seen in #11, BigFloat has a given precision, which at first I believed to be configurable, but apparently it's not. This means even with storing I've been thinking of taking strings, however, this can cause hassle in the long-run later as, once you find a way in to introduce data that isn't number (and there are a lot of ways), you can cause the program to crash/panic, which is better to avoid. But honestly, even a normal number type is too much, in theory, all we need is a float we can multiply, divide and mod to My best guess would be to store number as a tuple
Multiplication, division and modulo are easy to implement with that, and takes virtually no effort, but this requires to make a specific type to implement Maybe it's cool to make separate functions ( Maybe we should implement That's basically the internal discussion I have been having with myself, I don't know what are you thoughts on this? If you do have an interesting idea I am willing to hear it! |
Beta Was this translation helpful? Give feedback.
-
More info: https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency Btw, I was wrong about BigFloat nature. Excessive is an incorrect word. But still, I think it's unsuited for this crate purposes. |
Beta Was this translation helpful? Give feedback.
-
In fact, only a sequence of digits with optional minus and decimal period is needed. With BigFloat, some absolutely unneeded things like .acosh() or .is_subnormal() are compiled with this project for no reason.
I see two possible solutions:
With our own type, we can support some other kinds of numbers, e.g., common fractions.
Beta Was this translation helpful? Give feedback.
All reactions