rust-decimal icon indicating copy to clipboard operation
rust-decimal copied to clipboard

How can I get epsilon value for Decimal

Open vadim-su opened this issue 3 years ago • 1 comments

https://en.wikipedia.org/wiki/Machine_epsilon

vadim-su avatar Apr 23 '22 14:04 vadim-su

Hi @deterok, do you have a use case for requiring this?

The primary reason an epsilon isn't exposed right now is because unlike a floating point number which uses approximations for representing numbers we instead use a fixed precision format. If we were to instead define it as the smallest representable number then technically the machine epsilon would be either 5 × 10^−28 or 10^−27 since the maximum whole precision for this library is 28 (i.e. 29 is supported in some cases but not completely). However it'd be useful to understand the use case for this first to better answer the question.

paupino avatar Apr 23 '22 16:04 paupino

I guess we can close this stale issue :sweat_smile:

vadim-su avatar Nov 21 '23 09:11 vadim-su