Search code examples
ethereumsolidity

Does Solidity supports floating point number


I am new in solidity language. Have seen their documentation. Is there any floating point data type ?


Solution

  • There is no floating point in Solidity. You should keep numbers in whole number format.

    You can place decimal place in your front-end code. Take a look at how ERC20 contract was designed.

    Good read: https://medium.com/@jgm.orinoco/understanding-erc-20-token-contracts-a809a7310aa5