1

I've read this question and answer thread about representing decimal values in solidity, and I understand that math is entirely done using fixed-point.

However, I'm curious as to why this is the case. Is it because who numbers allow us to never loose any value? Couldn't we just not allow transactions to be processed that would have too many decimal places? (ie, give it an "always failing transaction" warning before processing?)

2
  • 1
    AFAIK, it's because not every machine (HW architecture) used by every miner is guaranteed to implement the same floating-point standard (or to even implement any floating-point standard). Commented Aug 28, 2020 at 20:30
  • I guess this will have to be the answer? Would you like to add that to the answers below or keep it as a comment? Commented Oct 14, 2020 at 11:49

1 Answer 1

1

Turning a comment into an answer:

As far as I know, floating-point variants are not supported in Solidity because not every machine (i.e., HW architecture) used by every miner is guaranteed to implement the same floating-point standard (or to even implement any floating-point standard to begin with).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.