Stephen Chung
Stephen Chung
> I'm working out how to wrap egui's API for my scripting language. Something that would make this a lot easier is if there was an alternative API to the...
checked_add() not catching underflow/overflow when adding a very large number to a very small number
> How does this make the lib any different from just 128bit floating point numbers? Technically speaking, there is no difference. Both are represented by an integral mantissa plus an...
In this case this is the wrong library for you. `rust-decimal` is not an infinite-precision library. It is fixed-precision, only with a large number of significant digits (I believe up...
In other words, you want methods to fail on _overflow_ or _underflow_, not rounding. I suppose the `checked_` versions should do this? Not sure why `checked_mul` doesn't... This is `checked_mul`:...
Just a hunch: `rust-decimal` I believe has 27 digits of precision (or something like that). Your example has 29 digits. Therefore, it cannot be represented by a `Decimal` in this...
No it isn't. It is complicated. Let me explain: 2^96 = 79228162514264337593543950336 You can see MAX-96-bits has 29 decimal digits. However, the first digit can no more than 7, therefore...
Well there goes the idea then. Nevertheless, `checked_mul` should easily see that both operands have scale of 28 and more, so there is a high potential for the result to...
Make sense! Underflow means very very small errors (errors that are smaller than the minimum number representable by this format) and in most usage you'd want to ignore it (therefore...
> This doesn't make much sense, as a number raised to an exponent smaller than 1 would yield a _smaller_ number (127_755, in this particular case). `Decimal` tries to maintain...
> We cannot. We are forbidden to use floating point at all, because of non-determinism, i.e. different results being obtained > in different implementations / architectures. I understand that the...