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). – goodvibration Aug 28 '20 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? – Patrick Collins Oct 14 '20 at 11:49
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, privacy policy and cookie policy

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