Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Solidity supports floating point number

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

like image 695
Anijit Sau Avatar asked Mar 03 '23 08:03

Anijit Sau


1 Answers

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

like image 70
Zulhilmi Zainudin Avatar answered Mar 24 '23 21:03

Zulhilmi Zainudin